Hi,

Over at Python Pillow - https://github.com/python-pillow/Pillow/issues/9146 - a 
user is trying to render a character with the following font - 
https://github.com/Adham-A/fontP5/blob/main/p5.ttf

The user is saying that when loading colored glyphs, the text should be larger 
than when it is loading without colored glyphs.

Here is code to demonstrate that FreeType reports the same height with and 
without FT_LOAD_COLOR.

    FT_Library library;
    FT_Init_FreeType(&library);
    FT_Face face = NULL;
    FT_New_Face(library, "./p5.ttf", 0, &face);
    FT_Set_Pixel_Sizes(face, 0, 200);
    FT_Glyph glyph;
    FT_BBox bbox;

    FT_Load_Glyph(face, 396, FT_LOAD_DEFAULT);
    FT_Get_Glyph(face->glyph, &glyph);
    FT_Glyph_Get_CBox(glyph, FT_GLYPH_BBOX_PIXELS, &bbox);
    printf("Glyph height without color %d\n", bbox.yMax - bbox.yMin);

    FT_Load_Glyph(face, 396, FT_LOAD_DEFAULT | FT_LOAD_COLOR);
    FT_Get_Glyph(face->glyph, &glyph);
    FT_Glyph_Get_CBox(glyph, FT_GLYPH_BBOX_PIXELS, &bbox);
    printf("Glyph height with color %d\n", bbox.yMax - bbox.yMin);

I’m surprised that this font is supposed to change size when using colored 
glyphs. I suspect that FreeType’s perspective is that glyphs should be the same 
size, whether they are colored or not, and this font is violating that. Could 
you confirm if you think this font is flawed, or if this is a bug in FreeType?

Thanks very much.

Reply via email to