From ba40054c2dd9f5d3d8561de7106870ac6a920f6d Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Tue, 2 May 2017 12:32:19 +0200 Subject: [PATCH] [autofit] Remove `slight' auto-hint mode again. A poll on freetype-devel favoured changes directly applied to `light'. * include/freetype/freetype.h (FT_LOAD_TARGET_SLIGHT, FT_RENDER_MODE_SLIGHT): Removed. * src/autofit/afcjk.c (af_cjk_hints_init), src/autofit/aflatin.c (af_latin_hints_init), src/autofit/aflatin2.c (af_latin2_hints_init): Revert change from 2017-04-22. * src/autofit/afloader.c (af_loader_load_glyph) Remove references to FT_RENDER_MODE_SLIGHT. [AF_CONFIG_OPTION_TT_SIZE_METRICS]: Enable TrueType-like metrics unconditionally. * src/base/ftadvanc.c (LOAD_ADVANCE_FAST_CHECK): Revert change from 2017-04-22. * src/base/ftobjs.c (FT_Load_Glyph): Revert change from 2017-04-22. * src/pshinter/pshalgo.c (ps_hints_apply): Revert change from 2017-04-22. * src/smooth/ftsmooth.c (ft_smooth_render): Revert change from 2017-04-22. * docs/CHANGES: Updated. --- ChangeLog | 32 ++++++++++++ docs/CHANGES | 19 +++++-- include/freetype/config/ftoption.h | 14 ++++-- include/freetype/freetype.h | 79 ++++++++++++++++-------------- src/autofit/afcjk.c | 7 +-- src/autofit/aflatin.c | 10 ++-- src/autofit/aflatin2.c | 10 ++-- src/autofit/afloader.c | 31 ++++-------- src/base/ftadvanc.c | 9 ++-- src/base/ftobjs.c | 9 ++-- src/pshinter/pshalgo.c | 3 +- src/smooth/ftsmooth.c | 3 +- src/truetype/ttgload.c | 2 +- src/truetype/ttobjs.c | 3 ++ 14 files changed, 131 insertions(+), 100 deletions(-) diff --git a/ChangeLog b/ChangeLog index b1ad07b28..8dd013ecc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,35 @@ +2017-05-02 Werner Lemberg + + [autofit] Remove `slight' auto-hint mode again. + + A poll on freetype-devel favoured changes directly applied to + `light'. + + * include/freetype/freetype.h (FT_LOAD_TARGET_SLIGHT, + FT_RENDER_MODE_SLIGHT): Removed. + + * src/autofit/afcjk.c (af_cjk_hints_init), src/autofit/aflatin.c + (af_latin_hints_init), src/autofit/aflatin2.c + (af_latin2_hints_init): Revert change from 2017-04-22. + + * src/autofit/afloader.c (af_loader_load_glyph) Remove references to + FT_RENDER_MODE_SLIGHT. + [AF_CONFIG_OPTION_TT_SIZE_METRICS]: Enable TrueType-like metrics + unconditionally. + + * src/base/ftadvanc.c (LOAD_ADVANCE_FAST_CHECK): Revert change from + 2017-04-22. + + * src/base/ftobjs.c (FT_Load_Glyph): Revert change from 2017-04-22. + + * src/pshinter/pshalgo.c (ps_hints_apply): Revert change from + 2017-04-22. + + * src/smooth/ftsmooth.c (ft_smooth_render): Revert change from + 2017-04-22. + + * docs/CHANGES: Updated. + 2017-04-30 Werner Lemberg [autofit] Fix metrics computation. diff --git a/docs/CHANGES b/docs/CHANGES index 8df2b13d5..d96be35fc 100644 --- a/docs/CHANGES +++ b/docs/CHANGES @@ -3,7 +3,9 @@ CHANGES BETWEEN 2.7.1 and 2.8 I. IMPORTANT CHANGES - - Support for OpenType Variation Fonts is now complete. + - Support for OpenType Variation Fonts is now complete. The last + missing part was handling the `VVAR' and `MVAR' tables, which is + available with this release. - A new function `FT_Face_Properties' allows the control of some module and library properties per font. Currently, the @@ -19,12 +21,21 @@ CHANGES BETWEEN 2.7.1 and 2.8 FREETYPE_PROPERTIES=pcf:no-long-family-names=1 - - Variations font support now takes care of the `VVAR' and `MVAR' - tables also. - II. IMPORTANT BUG FIXES + - `Light' auto-hinting mode no longer uses TrueType metrics for + TrueType fonts. This bug was introduced in version 2.4.6, + causing horizontal scaling also. Almost all GNU/Linux + distributions (with Fedora as a notable exception) disabled the + corresponding patch for good reasons; chances are thus high that + you won't notice a difference. + + If optical backward compatibility for legacy applications is + necessary, you might enable the AF_CONFIG_OPTION_TT_SIZE_METRICS + configuration option. However, it is strongly recommended to + avoid that, adjusting font sizes instead. + - If a TrueType font gets loaded with FT_LOAD_NO_HINTING, FreeType now scales the font linearly again (bug introduced in version 2.4.6). diff --git a/include/freetype/config/ftoption.h b/include/freetype/config/ftoption.h index 69d30a498..1bf6e8f53 100644 --- a/include/freetype/config/ftoption.h +++ b/include/freetype/config/ftoption.h @@ -909,11 +909,15 @@ FT_BEGIN_HEADER /*************************************************************************/ /* */ - /* Use TrueType-like size metrics for `light' auto-hinting. This option */ - /* exists mainly for backwards compatibility with GNU/Linux */ - /* distributions like Fedora that did not un-patch the following change */ - /* (which was present in FreeType between versions 2.4.6 and 2.7.1, */ - /* inclusive). */ + /* Use TrueType-like size metrics for `light' auto-hinting. */ + /* */ + /* It is strongly recommended to avoid this option, which exists only to */ + /* help some legacy applications retain its appearance and behaviour */ + /* with respect to auto-hinted TrueType fonts. */ + /* */ + /* The very reason this option exists at all are GNU/Linux distributions */ + /* like Fedora that did not un-patch the following change (which was */ + /* present in FreeType between versions 2.4.6 and 2.7.1, inclusive). */ /* */ /* 2011-07-16 Steven Chu */ /* */ diff --git a/include/freetype/freetype.h b/include/freetype/freetype.h index 681d8e93d..c3bc7049f 100644 --- a/include/freetype/freetype.h +++ b/include/freetype/freetype.h @@ -221,7 +221,6 @@ FT_BEGIN_HEADER /* */ /* FT_LOAD_TARGET_NORMAL */ /* FT_LOAD_TARGET_LIGHT */ - /* FT_LOAD_TARGET_SLIGHT */ /* FT_LOAD_TARGET_MONO */ /* FT_LOAD_TARGET_LCD */ /* FT_LOAD_TARGET_LCD_V */ @@ -1756,12 +1755,37 @@ FT_BEGIN_HEADER /* `slot->format' is also changed to @FT_GLYPH_FORMAT_BITMAP. */ /* */ /* Here is a small pseudo code fragment that shows how to use */ - /* `lsb_delta' and `rsb_delta' to improve (integer) positioning of */ + /* `lsb_delta' and `rsb_delta' to do fractional positioning of */ /* glyphs: */ /* */ /* { */ - /* FT_Pos origin_x = 0; */ - /* FT_Pos prev_rsb_delta = 0; */ + /* FT_GlyphSlot slot = face->glyph; */ + /* FT_Pos origin_x = 0; */ + /* */ + /* */ + /* for all glyphs do */ + /* */ + /* */ + /* FT_Outline_Translate( slot->outline, origin_x & 63, 0 ); */ + /* */ + /* */ + /* */ + /* */ + /* */ + /* origin_x += slot->advance.x; */ + /* origin_x += slot->rsb_delta - slot->lsb_relta; */ + /* endfor */ + /* } */ + /* */ + /* Here is another small pseudo code fragment that shows how to use */ + /* `lsb_delta' and `rsb_delta' to improve integer positioning of */ + /* glyphs: */ + /* */ + /* { */ + /* FT_GlyphSlot slot = face->glyph; */ + /* FT_Pos origin_x = 0; */ + /* FT_Pos prev_rsb_delta = 0; */ /* */ /* */ /* for all glyphs do */ @@ -1770,16 +1794,16 @@ FT_BEGIN_HEADER /* */ /* */ /* */ - /* if ( prev_rsb_delta - face->glyph->lsb_delta >= 32 ) */ + /* if ( prev_rsb_delta - slot->lsb_delta >= 32 ) */ /* origin_x -= 64; */ - /* else if ( prev_rsb_delta - face->glyph->lsb_delta < -32 ) */ + /* else if ( prev_rsb_delta - slot->lsb_delta < -32 ) */ /* origin_x += 64; */ /* */ - /* prev_rsb_delta = face->glyph->rsb_delta; */ + /* prev_rsb_delta = slot->rsb_delta; */ /* */ /* */ /* */ - /* origin_x += face->glyph->advance.x; */ + /* origin_x += slot->advance.x; */ /* endfor */ /* } */ /* */ @@ -2937,8 +2961,8 @@ FT_BEGIN_HEADER * rendering. For monochrome output, use @FT_LOAD_TARGET_MONO * instead. * - * FT_LOAD_TARGET_SLIGHT :: - * A slight hinting algorithm for gray-level modes. Many generated + * FT_LOAD_TARGET_LIGHT :: + * A lighter hinting algorithm for gray-level modes. Many generated * glyphs are fuzzier but better resemble their original shape. This * is achieved by snapping glyphs to the pixel grid only vertically * (Y-axis), as is done by FreeType's new CFF engine or Microsoft's @@ -2947,25 +2971,16 @@ FT_BEGIN_HEADER * driver, if the driver itself and the font support it, or by the * auto-hinter. * - * Advance widths are not rounded to integer values; instead, metrics - * are based on linearly scaled values. In particular this implies - * that you have to apply sub-pixel rendering. - * - * FT_LOAD_TARGET_LIGHT :: - * This is similar to @FT_LOAD_TARGET_SLIGHT with a main difference: - * It uses integer advance widths. + * Advance widths are rounded to integer values; however, using the + * `lsb_delta' and `rsb_delta' fields of @FT_GlyphSlotRec, it is + * possible to get fractional advance widths for sub-pixel positioning + * (which is recommended to use). * * If configuration option AF_CONFIG_OPTION_TT_SIZE_METRICS is active, * TrueType-like metrics are used to make this mode behave similarly * as in unpatched FreeType versions between 2.4.6 and 2.7.1 * (inclusive). * - * This hinting mode is deprecated. In general, - * @FT_LOAD_TARGET_SLIGHT always yields better results; additionally, - * FT_LOAD_TARGET_LIGHT suffers from backwards compatibility issues - * (see the documentation of AF_CONFIG_OPTION_TT_SIZE_METRICS in - * `ftoption.h' for more details). - * * FT_LOAD_TARGET_MONO :: * Strong hinting algorithm that should only be used for monochrome * output. The result is probably unpleasant if the glyph is rendered @@ -3001,18 +3016,17 @@ FT_BEGIN_HEADER * } * * In general, you should stick with one rendering mode. For example, - * switching between @FT_LOAD_TARGET_LIGHT and @FT_LOAD_TARGET_SLIGHT - * enforces a lot of recomputation, which is slow. Another reason is - * caching: Selecting a different mode usually causes changes in both - * the outlines and the rasterized bitmaps; it is thus necessary to - * empty the cache after a mode switch to avoid false hits. + * switching between @FT_LOAD_TARGET_NORMAL and @FT_LOAD_TARGET_MONO + * enforces a lot of recomputation for TrueType fonts, which is slow. + * Another reason is caching: Selecting a different mode usually causes + * changes in both the outlines and the rasterized bitmaps; it is thus + * necessary to empty the cache after a mode switch to avoid false hits. * */ #define FT_LOAD_TARGET_( x ) ( (FT_Int32)( (x) & 15 ) << 16 ) #define FT_LOAD_TARGET_NORMAL FT_LOAD_TARGET_( FT_RENDER_MODE_NORMAL ) #define FT_LOAD_TARGET_LIGHT FT_LOAD_TARGET_( FT_RENDER_MODE_LIGHT ) -#define FT_LOAD_TARGET_SLIGHT FT_LOAD_TARGET_( FT_RENDER_MODE_SLIGHT ) #define FT_LOAD_TARGET_MONO FT_LOAD_TARGET_( FT_RENDER_MODE_MONO ) #define FT_LOAD_TARGET_LCD FT_LOAD_TARGET_( FT_RENDER_MODE_LCD ) #define FT_LOAD_TARGET_LCD_V FT_LOAD_TARGET_( FT_RENDER_MODE_LCD_V ) @@ -3093,12 +3107,6 @@ FT_BEGIN_HEADER /* indirectly to define hinting algorithm selectors. See */ /* @FT_LOAD_TARGET_XXX for details. */ /* */ - /* FT_RENDER_MODE_SLIGHT :: */ - /* This is equivalent to @FT_RENDER_MODE_NORMAL. It is only */ - /* defined as a separate value because render modes are also used */ - /* indirectly to define hinting algorithm selectors. See */ - /* @FT_LOAD_TARGET_XXX for details. */ - /* */ /* FT_RENDER_MODE_MONO :: */ /* This mode corresponds to 1-bit bitmaps (with 2~levels of */ /* opacity). */ @@ -3134,7 +3142,6 @@ FT_BEGIN_HEADER FT_RENDER_MODE_MONO, FT_RENDER_MODE_LCD, FT_RENDER_MODE_LCD_V, - FT_RENDER_MODE_SLIGHT, FT_RENDER_MODE_MAX diff --git a/src/autofit/afcjk.c b/src/autofit/afcjk.c index 86b8b4067..61e29cded 100644 --- a/src/autofit/afcjk.c +++ b/src/autofit/afcjk.c @@ -1398,12 +1398,9 @@ other_flags |= AF_LATIN_HINTS_VERT_SNAP; /* - * We adjust stems to full pixels unless in `light', `slight', - * or `lcd' mode. + * We adjust stems to full pixels unless in `light' or `lcd' mode. */ - if ( mode != FT_RENDER_MODE_LIGHT && - mode != FT_RENDER_MODE_SLIGHT && - mode != FT_RENDER_MODE_LCD ) + if ( mode != FT_RENDER_MODE_LIGHT && mode != FT_RENDER_MODE_LCD ) other_flags |= AF_LATIN_HINTS_STEM_ADJUST; if ( mode == FT_RENDER_MODE_MONO ) diff --git a/src/autofit/aflatin.c b/src/autofit/aflatin.c index e03fdf01f..11fa523c8 100644 --- a/src/autofit/aflatin.c +++ b/src/autofit/aflatin.c @@ -2577,9 +2577,7 @@ /* * We adjust stems to full pixels unless in `light' or `lcd' mode. */ - if ( mode != FT_RENDER_MODE_LIGHT && - mode != FT_RENDER_MODE_SLIGHT && - mode != FT_RENDER_MODE_LCD ) + if ( mode != FT_RENDER_MODE_LIGHT && mode != FT_RENDER_MODE_LCD ) other_flags |= AF_LATIN_HINTS_STEM_ADJUST; if ( mode == FT_RENDER_MODE_MONO ) @@ -2592,10 +2590,8 @@ * However, if warping is enabled (which only works in `light' hinting * mode), advance widths get adjusted, too. */ - if ( mode == FT_RENDER_MODE_LIGHT || - mode == FT_RENDER_MODE_SLIGHT || - mode == FT_RENDER_MODE_LCD || - ( face->style_flags & FT_STYLE_FLAG_ITALIC ) != 0 ) + if ( mode == FT_RENDER_MODE_LIGHT || mode == FT_RENDER_MODE_LCD || + ( face->style_flags & FT_STYLE_FLAG_ITALIC ) != 0 ) scaler_flags |= AF_SCALER_FLAG_NO_HORIZONTAL; #ifdef AF_CONFIG_OPTION_USE_WARPER diff --git a/src/autofit/aflatin2.c b/src/autofit/aflatin2.c index 87ab91d8e..0607278b1 100644 --- a/src/autofit/aflatin2.c +++ b/src/autofit/aflatin2.c @@ -1560,9 +1560,7 @@ /* * We adjust stems to full pixels unless in `light' or `lcd' mode. */ - if ( mode != FT_RENDER_MODE_LIGHT && - mode != FT_RENDER_MODE_SLIGHT && - mode != FT_RENDER_MODE_LCD ) + if ( mode != FT_RENDER_MODE_LIGHT && mode != FT_RENDER_MODE_LCD ) other_flags |= AF_LATIN_HINTS_STEM_ADJUST; if ( mode == FT_RENDER_MODE_MONO ) @@ -1572,10 +1570,8 @@ * In `light' or `lcd' mode we disable horizontal hinting completely. * We also do it if the face is italic. */ - if ( mode == FT_RENDER_MODE_LIGHT || - mode == FT_RENDER_MODE_SLIGHT || - mode == FT_RENDER_MODE_LCD || - ( face->style_flags & FT_STYLE_FLAG_ITALIC ) != 0 ) + if ( mode == FT_RENDER_MODE_LIGHT || mode == FT_RENDER_MODE_LCD || + ( face->style_flags & FT_STYLE_FLAG_ITALIC ) != 0 ) scaler_flags |= AF_SCALER_FLAG_NO_HORIZONTAL; #ifdef AF_CONFIG_OPTION_USE_WARPER diff --git a/src/autofit/afloader.c b/src/autofit/afloader.c index b3269d10b..ddf47ebcf 100644 --- a/src/autofit/afloader.c +++ b/src/autofit/afloader.c @@ -245,15 +245,14 @@ if ( !size_internal->autohint_metrics.x_scale || size_internal->autohint_mode != FT_LOAD_TARGET_MODE( load_flags ) ) { - /* switching between LIGHT and SLIGHT (and vice versa) usually means */ - /* different scaling values; this later on enforces recomputation of */ - /* everything related to the current size */ + /* switching between hinting modes usually means different scaling */ + /* values; this later on enforces recomputation of everything */ + /* related to the current size */ size_internal->autohint_mode = FT_LOAD_TARGET_MODE( load_flags ); size_internal->autohint_metrics = size->metrics; #ifdef AF_CONFIG_OPTION_TT_SIZE_METRICS - if ( size_internal->autohint_mode != FT_RENDER_MODE_SLIGHT ) { FT_Size_Metrics* size_metrics = &size_internal->autohint_metrics; @@ -382,12 +381,11 @@ * */ - /* stem darkening only works well in `light' and `slight' modes */ - if ( ( scaler.render_mode == FT_RENDER_MODE_LIGHT || - scaler.render_mode == FT_RENDER_MODE_SLIGHT ) && + /* stem darkening only works well in `light' mode */ + if ( scaler.render_mode == FT_RENDER_MODE_LIGHT && ( !face->internal->no_stem_darkening || ( face->internal->no_stem_darkening < 0 && - !module->no_stem_darkening ) ) ) + !module->no_stem_darkening ) ) ) af_loader_embolden_glyph_in_slot( loader, face, style_metrics ); loader->transformed = slot_internal->glyph_transformed; @@ -435,8 +433,7 @@ /* we now need to adjust the metrics according to the change in */ /* width/positioning that occurred during the hinting process */ - if ( scaler.render_mode != FT_RENDER_MODE_LIGHT && - scaler.render_mode != FT_RENDER_MODE_SLIGHT ) + if ( scaler.render_mode != FT_RENDER_MODE_LIGHT ) { FT_Pos old_rsb, old_lsb, new_lsb; FT_Pos pp1x_uh, pp2x_uh; @@ -494,9 +491,8 @@ } } /* `light' mode uses integer advance widths */ - /* (but sets `lsb_delta' and `rsb_delta'), */ - /* `slight' mode uses fractional values */ - else if ( scaler.render_mode == FT_RENDER_MODE_LIGHT ) + /* but sets `lsb_delta' and `rsb_delta' */ + else { FT_Pos pp1x = loader->pp1.x; FT_Pos pp2x = loader->pp2.x; @@ -508,11 +504,6 @@ slot->lsb_delta = loader->pp1.x - pp1x; slot->rsb_delta = loader->pp2.x - pp2x; } - else - { - slot->lsb_delta = 0; - slot->rsb_delta = 0; - } break; @@ -563,7 +554,6 @@ /* to keep the original rounded advance width; ditto for */ /* digits if all have the same advance width */ if ( scaler.render_mode != FT_RENDER_MODE_LIGHT && - scaler.render_mode != FT_RENDER_MODE_SLIGHT && ( FT_IS_FIXED_WIDTH( slot->face ) || ( af_face_globals_is_digit( loader->globals, glyph_index ) && style_metrics->digits_have_same_width ) ) ) @@ -587,8 +577,7 @@ slot->metrics.vertAdvance = FT_MulFix( slot->metrics.vertAdvance, style_metrics->scaler.y_scale ); - if ( scaler.render_mode != FT_RENDER_MODE_SLIGHT ) - slot->metrics.horiAdvance = FT_PIX_ROUND( slot->metrics.horiAdvance ); + slot->metrics.horiAdvance = FT_PIX_ROUND( slot->metrics.horiAdvance ); slot->metrics.vertAdvance = FT_PIX_ROUND( slot->metrics.vertAdvance ); slot->format = FT_GLYPH_FORMAT_OUTLINE; diff --git a/src/base/ftadvanc.c b/src/base/ftadvanc.c index 5f2e0b167..1557607fc 100644 --- a/src/base/ftadvanc.c +++ b/src/base/ftadvanc.c @@ -59,15 +59,14 @@ /* */ /* - unscaled load */ /* - unhinted load */ - /* - light-hinted and slight-hinted load */ + /* - light-hinted load */ /* - if a variations font, it must have an `HVAR' or `VVAR' */ /* table (thus the old MM or GX fonts don't qualify; this */ /* gets checked by the driver-specific functions) */ -#define LOAD_ADVANCE_FAST_CHECK( face, flags ) \ - ( flags & ( FT_LOAD_NO_SCALE | FT_LOAD_NO_HINTING ) || \ - ( FT_LOAD_TARGET_MODE( flags ) == FT_RENDER_MODE_LIGHT || \ - FT_LOAD_TARGET_MODE( flags ) == FT_RENDER_MODE_SLIGHT ) ) +#define LOAD_ADVANCE_FAST_CHECK( face, flags ) \ + ( flags & ( FT_LOAD_NO_SCALE | FT_LOAD_NO_HINTING ) || \ + FT_LOAD_TARGET_MODE( flags ) == FT_RENDER_MODE_LIGHT ) /* documentation is in ftadvanc.h */ diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c index cbc771322..539116e85 100644 --- a/src/base/ftobjs.c +++ b/src/base/ftobjs.c @@ -668,8 +668,8 @@ * - Then, auto-hint if FT_LOAD_FORCE_AUTOHINT is set or if we don't * have a native font hinter. * - * - Otherwise, auto-hint for LIGHT or SLIGHT hinting mode or if there - * isn't any hinting bytecode in the TrueType/OpenType font. + * - Otherwise, auto-hint for LIGHT hinting mode or if there isn't + * any hinting bytecode in the TrueType/OpenType font. * * - Exception: The font is `tricky' and requires the native hinter to * load properly. @@ -702,9 +702,8 @@ /* check the size of the `fpgm' and `prep' tables, too -- */ /* the assumption is that there don't exist real TTFs where */ /* both `fpgm' and `prep' tables are missing */ - if ( ( ( mode == FT_RENDER_MODE_LIGHT || - mode == FT_RENDER_MODE_SLIGHT ) && - !FT_DRIVER_HINTS_LIGHTLY( driver ) ) || + if ( ( mode == FT_RENDER_MODE_LIGHT && + !FT_DRIVER_HINTS_LIGHTLY( driver ) ) || ( FT_IS_SFNT( face ) && ttface->num_locations && ttface->max_profile.maxSizeOfInstructions == 0 && diff --git a/src/pshinter/pshalgo.c b/src/pshinter/pshalgo.c index 27cb229eb..9ad1a3a02 100644 --- a/src/pshinter/pshalgo.c +++ b/src/pshinter/pshalgo.c @@ -2149,8 +2149,7 @@ glyph->do_vert_snapping = FT_BOOL( hint_mode == FT_RENDER_MODE_MONO || hint_mode == FT_RENDER_MODE_LCD_V ); - glyph->do_stem_adjust = FT_BOOL( hint_mode != FT_RENDER_MODE_LIGHT && - hint_mode != FT_RENDER_MODE_SLIGHT ); + glyph->do_stem_adjust = FT_BOOL( hint_mode != FT_RENDER_MODE_LIGHT ); for ( dimension = 0; dimension < 2; dimension++ ) { diff --git a/src/smooth/ftsmooth.c b/src/smooth/ftsmooth.c index 52e61e559..435854e67 100644 --- a/src/smooth/ftsmooth.c +++ b/src/smooth/ftsmooth.c @@ -433,8 +433,7 @@ FT_Render_Mode mode, const FT_Vector* origin ) { - if ( mode == FT_RENDER_MODE_LIGHT || - mode == FT_RENDER_MODE_SLIGHT ) + if ( mode == FT_RENDER_MODE_LIGHT ) mode = FT_RENDER_MODE_NORMAL; return ft_smooth_render_generic( render, slot, mode, origin, diff --git a/src/truetype/ttgload.c b/src/truetype/ttgload.c index c5d548f0b..9c1e109c3 100644 --- a/src/truetype/ttgload.c +++ b/src/truetype/ttgload.c @@ -2737,7 +2737,7 @@ /* TrueType glyphs at all sizes using the bytecode interpreter. */ /* */ if ( !( load_flags & FT_LOAD_NO_SCALE ) && - size->metrics->y_ppem < 24 ) + size->metrics->y_ppem < 24 ) glyph->outline.flags |= FT_OUTLINE_HIGH_PRECISION; Exit: diff --git a/src/truetype/ttobjs.c b/src/truetype/ttobjs.c index 64011e86e..d20e3da07 100644 --- a/src/truetype/ttobjs.c +++ b/src/truetype/ttobjs.c @@ -1234,6 +1234,7 @@ /* */ if ( face->header.Flags & 8 ) { + /* the TT spec always asks for ROUND, not FLOOR or CEIL */ size_metrics->ascender = FT_PIX_ROUND( FT_MulFix( face->root.ascender, size_metrics->y_scale ) ); @@ -1252,6 +1253,8 @@ if ( face->header.Flags & 8 ) { + /* base scaling values on integer ppem values, */ + /* as mandated by the TrueType specification */ size_metrics->x_scale = FT_DivFix( size_metrics->x_ppem << 6, face->root.units_per_EM ); size_metrics->y_scale = FT_DivFix( size_metrics->y_ppem << 6,