From 60199ac01d711d3240146afedd830b774eb5c5d2 Mon Sep 17 00:00:00 2001 From: Po Lu Date: Tue, 26 Dec 2023 14:09:42 +0800 Subject: [PATCH] ; * src/ftfont.c (ftfont_glyph_metrics): Comment on advance rounding. --- src/ftfont.c | 6 ++++++ 1 file changed, 6 insertions(+) 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; -- 2.39.2