From: Po Lu Date: Tue, 26 Dec 2023 06:09:42 +0000 (+0800) Subject: ; * src/ftfont.c (ftfont_glyph_metrics): Comment on advance rounding. X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=60199ac01d711d3240146afedd830b774eb5c5d2;p=emacs.git ; * src/ftfont.c (ftfont_glyph_metrics): Comment on advance rounding. --- diff --git a/src/ftfont.c b/src/ftfont.c index d3c836c0f2d..46abe35ff9a 100644 --- a/src/ftfont.c +++ b/src/ftfont.c @@ -1572,6 +1572,12 @@ ftfont_glyph_metrics (FT_Face ft_face, int c, int *advance, int *lbearing, if (FT_Load_Glyph (ft_face, c, FT_LOAD_DEFAULT) == 0) { FT_Glyph_Metrics *m = &ft_face->glyph->metrics; + + /* At first glance this might appear to truncate the glyph's + horizontal advance, but FreeType internally rounds the + advance width to a pixel boundary prior to returning these + metrics. */ + *advance = m->horiAdvance >> 6; *lbearing = m->horiBearingX >> 6; *rbearing = (m->horiBearingX + m->width) >> 6;