|
| 1 | +From ae0ac2d1217a0be13db0a7e4eeec46085b0b6775 Mon Sep 17 00:00:00 2001 |
| 2 | +From: Fushan Wen < [email protected]> |
| 3 | +Date: Sun, 17 Sep 2023 13:15:29 +0800 |
| 4 | +Subject: [PATCH] src/base/ftsynth.c: keep compatiblity in |
| 5 | + FT_GlyphSlot_Embolden |
| 6 | + |
| 7 | +The delta is highly a matter of taste, but the style should be consistent. In some old applications x_scale and y_scale do not always match x_ppem and y_ppem, so fixed delta values will break bold fonts in those existing applications. |
| 8 | +--- |
| 9 | + src/base/ftsynth.c | 17 ++++++++++++++++- |
| 10 | + 1 file changed, 16 insertions(+), 1 deletion(-) |
| 11 | + |
| 12 | +diff --git a/src/base/ftsynth.c b/src/base/ftsynth.c |
| 13 | +index f32edd338..c397a374f 100644 |
| 14 | +--- a/src/base/ftsynth.c |
| 15 | ++++ b/src/base/ftsynth.c |
| 16 | +@@ -98,7 +98,22 @@ |
| 17 | + FT_EXPORT_DEF( void ) |
| 18 | + FT_GlyphSlot_Embolden( FT_GlyphSlot slot ) |
| 19 | + { |
| 20 | +- FT_GlyphSlot_AdjustWeight( slot, 0x0AAA, 0x0AAA ); |
| 21 | ++ FT_UShort units_per_EM; |
| 22 | ++ FT_Size_Metrics* metrics; |
| 23 | ++ FT_Fixed xdelta, ydelta; |
| 24 | ++ |
| 25 | ++ if ( !slot ) |
| 26 | ++ return; |
| 27 | ++ |
| 28 | ++ units_per_EM = slot->face->units_per_EM; |
| 29 | ++ metrics = &( slot->face->size->metrics ); |
| 30 | ++ |
| 31 | ++ xdelta = FT_MulFix( units_per_EM, metrics->x_scale / 24 ) * 1024 / |
| 32 | ++ (FT_Pos)metrics->x_ppem; |
| 33 | ++ ydelta = FT_MulFix( units_per_EM, metrics->y_scale / 24 ) * 1024 / |
| 34 | ++ (FT_Pos)metrics->y_ppem; |
| 35 | ++ |
| 36 | ++ FT_GlyphSlot_AdjustWeight( slot, xdelta, ydelta ); |
| 37 | + } |
| 38 | + |
| 39 | + |
| 40 | +-- |
| 41 | +2.45.2 |
| 42 | + |
0 commit comments