mirror of
https://github.com/aseprite/aseprite.git
synced 2024-12-27 12:20:58 +00:00
Use bearingX adjustment to render FreeType glyphs correctly
This commit is contained in:
parent
8304b7511d
commit
6d3c09d088
@ -21,6 +21,7 @@ namespace ft {
|
|||||||
FT_UInt glyph_index;
|
FT_UInt glyph_index;
|
||||||
FT_Glyph ft_glyph;
|
FT_Glyph ft_glyph;
|
||||||
FT_Bitmap* bitmap;
|
FT_Bitmap* bitmap;
|
||||||
|
double bearingX;
|
||||||
double bearingY;
|
double bearingY;
|
||||||
double x;
|
double x;
|
||||||
double y;
|
double y;
|
||||||
@ -121,7 +122,7 @@ namespace ft {
|
|||||||
this->m_face, glyph_index, this->m_antialias);
|
this->m_face, glyph_index, this->m_antialias);
|
||||||
if (glyph) {
|
if (glyph) {
|
||||||
glyph->bitmap = &FT_BitmapGlyph(glyph->ft_glyph)->bitmap;
|
glyph->bitmap = &FT_BitmapGlyph(glyph->ft_glyph)->bitmap;
|
||||||
glyph->x = x;
|
glyph->x = x + glyph->bearingX;
|
||||||
glyph->y = y
|
glyph->y = y
|
||||||
+ this->height()
|
+ this->height()
|
||||||
+ this->descender() // descender is negative
|
+ this->descender() // descender is negative
|
||||||
@ -188,6 +189,7 @@ namespace ft {
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_glyph.ft_glyph = ft_glyph;
|
m_glyph.ft_glyph = ft_glyph;
|
||||||
|
m_glyph.bearingX = face->glyph->metrics.horiBearingX / 64.0;
|
||||||
m_glyph.bearingY = face->glyph->metrics.horiBearingY / 64.0;
|
m_glyph.bearingY = face->glyph->metrics.horiBearingY / 64.0;
|
||||||
|
|
||||||
return &m_glyph;
|
return &m_glyph;
|
||||||
|
Loading…
Reference in New Issue
Block a user