diff options
| author | Po Lu | 2023-02-08 17:04:42 +0800 |
|---|---|---|
| committer | Po Lu | 2023-02-08 17:04:42 +0800 |
| commit | ad3def330cd0696c832f338dcf8b913e0d8e2b35 (patch) | |
| tree | ac0bd8ee6019a5eb1d9856a2b210e7976fd15109 /src | |
| parent | 1a70941c8ed58e5b78fec406f30457765f38daef (diff) | |
| download | emacs-ad3def330cd0696c832f338dcf8b913e0d8e2b35.tar.gz emacs-ad3def330cd0696c832f338dcf8b913e0d8e2b35.zip | |
Correctly round bearing values while computing pcm
* src/sfntfont.c (sfntfont_measure_instructed_pcm)
(sfntfont_measure_pcm): Ceil rbearing value.
Diffstat (limited to 'src')
| -rw-r--r-- | src/sfntfont.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/sfntfont.c b/src/sfntfont.c index dbd1a037f4a..607ab30afd5 100644 --- a/src/sfntfont.c +++ b/src/sfntfont.c | |||
| @@ -2277,9 +2277,8 @@ sfntfont_measure_instructed_pcm (struct sfnt_font_info *font, sfnt_glyph glyph, | |||
| 2277 | /* Scale the metrics by the interpreter's scale. */ | 2277 | /* Scale the metrics by the interpreter's scale. */ |
| 2278 | sfnt_scale_metrics (&metrics, font->interpreter->scale); | 2278 | sfnt_scale_metrics (&metrics, font->interpreter->scale); |
| 2279 | 2279 | ||
| 2280 | /* How to round lbearing and rbearing? */ | ||
| 2281 | pcm->lbearing = metrics.lbearing >> 16; | 2280 | pcm->lbearing = metrics.lbearing >> 16; |
| 2282 | pcm->rbearing = outline->xmax >> 16; | 2281 | pcm->rbearing = SFNT_CEIL_FIXED (outline->xmax) >> 16; |
| 2283 | 2282 | ||
| 2284 | /* Round the advance, ascent and descent upwards. */ | 2283 | /* Round the advance, ascent and descent upwards. */ |
| 2285 | pcm->width = SFNT_CEIL_FIXED (metrics.advance) >> 16; | 2284 | pcm->width = SFNT_CEIL_FIXED (metrics.advance) >> 16; |
| @@ -2324,7 +2323,7 @@ sfntfont_measure_pcm (struct sfnt_font_info *font, sfnt_glyph glyph, | |||
| 2324 | 2323 | ||
| 2325 | /* How to round lbearing and rbearing? */ | 2324 | /* How to round lbearing and rbearing? */ |
| 2326 | pcm->lbearing = metrics.lbearing >> 16; | 2325 | pcm->lbearing = metrics.lbearing >> 16; |
| 2327 | pcm->rbearing = outline->xmax >> 16; | 2326 | pcm->rbearing = SFNT_CEIL_FIXED (outline->xmax) >> 16; |
| 2328 | 2327 | ||
| 2329 | /* Round the advance, ascent and descent upwards. */ | 2328 | /* Round the advance, ascent and descent upwards. */ |
| 2330 | pcm->width = SFNT_CEIL_FIXED (metrics.advance) >> 16; | 2329 | pcm->width = SFNT_CEIL_FIXED (metrics.advance) >> 16; |