]> git.eshelyaron.com Git - emacs.git/commitdiff
Correctly round bearing values while computing pcm
authorPo Lu <luangruo@yahoo.com>
Wed, 8 Feb 2023 09:04:42 +0000 (17:04 +0800)
committerPo Lu <luangruo@yahoo.com>
Wed, 8 Feb 2023 09:04:42 +0000 (17:04 +0800)
* src/sfntfont.c (sfntfont_measure_instructed_pcm)
(sfntfont_measure_pcm): Ceil rbearing value.

src/sfntfont.c

index dbd1a037f4a8a9a4d16ba9d5e1a22ce6691f9faa..607ab30afd5edfc03725f748dd6a46833318db44 100644 (file)
@@ -2277,9 +2277,8 @@ sfntfont_measure_instructed_pcm (struct sfnt_font_info *font, sfnt_glyph glyph,
   /* Scale the metrics by the interpreter's scale.  */
   sfnt_scale_metrics (&metrics, font->interpreter->scale);
 
-  /* How to round lbearing and rbearing? */
   pcm->lbearing = metrics.lbearing >> 16;
-  pcm->rbearing = outline->xmax >> 16;
+  pcm->rbearing = SFNT_CEIL_FIXED (outline->xmax) >> 16;
 
   /* Round the advance, ascent and descent upwards.  */
   pcm->width = SFNT_CEIL_FIXED (metrics.advance) >> 16;
@@ -2324,7 +2323,7 @@ sfntfont_measure_pcm (struct sfnt_font_info *font, sfnt_glyph glyph,
 
   /* How to round lbearing and rbearing? */
   pcm->lbearing = metrics.lbearing >> 16;
-  pcm->rbearing = outline->xmax >> 16;
+  pcm->rbearing = SFNT_CEIL_FIXED (outline->xmax) >> 16;
 
   /* Round the advance, ascent and descent upwards.  */
   pcm->width = SFNT_CEIL_FIXED (metrics.advance) >> 16;