Re: Font rendering question

Andrew Murray <[email protected]> Mon, 18 Aug 2025 19:35:24 +1000
Newsgroups gmane.comp.fonts.freetype.user
Message-ID <[email protected]>
Hi,

Just a reminder. If you are busy with other matters, I understand, I =
just want to make sure this hasn=E2=80=99t been forgotten.

Thanks.

> On 11 Aug 2025, at 7:40=E2=80=AFam, Andrew Murray =
<[email protected]> wrote:
>=20
> Hi,
>=20
> 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
>=20
> The user is saying that when loading colored glyphs, the text should =
be larger than when it is loading without colored glyphs.
>=20
> Here is code to demonstrate that FreeType reports the same height with =
and without FT_LOAD_COLOR.
>=20
>     FT_Library library;
>     FT_Init_FreeType(&library);
>     FT_Face face =3D NULL;
>     FT_New_Face(library, "./p5.ttf", 0, &face);
>     FT_Set_Pixel_Sizes(face, 0, 200);
>     FT_Glyph glyph;
>     FT_BBox bbox;
>=20
>     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);
>=20
>     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);
>=20
> I=E2=80=99m surprised that this font is supposed to change size when =
using colored glyphs. I suspect that FreeType=E2=80=99s 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?
>=20
> Thanks very much.