summaryrefslogtreecommitdiff
path: root/src/ftfont.c
diff options
context:
space:
mode:
authorPo Lu <luangruo@yahoo.com>2023-12-26 14:09:42 +0800
committerPo Lu <luangruo@yahoo.com>2023-12-26 14:10:57 +0800
commit60199ac01d711d3240146afedd830b774eb5c5d2 (patch)
tree5e964e9fa86210860ee5cc55692409fe0df1c1d6 /src/ftfont.c
parentcd91ecedcbdf03ae13f45cb173360b11f13a0bc0 (diff)
downloademacs-60199ac01d711d3240146afedd830b774eb5c5d2.tar.gz
; * src/ftfont.c (ftfont_glyph_metrics): Comment on advance rounding.
Diffstat (limited to 'src/ftfont.c')
-rw-r--r--src/ftfont.c6
1 files changed, 6 insertions, 0 deletions
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;