From 5b5f382b7d093e085d41be95cd73075acb5cd1a2 Mon Sep 17 00:00:00 2001 From: David Turner Date: Wed, 14 Dec 2005 16:37:15 +0000 Subject: [PATCH] * src/autofit/aflatin.c, src/autofit/afhints.c: changed the implementation of the LIGHT hinting mode to completely disable horizontal hinting. This is an experimental effort to integrate David Chester's latest patch without fucking the other hinting modes as well. Note that this doesn't force auto-hinting for all fonts however. --- ChangeLog | 14 ++++++++++++-- src/autofit/afhints.c | 5 ++--- src/autofit/aflatin.c | 21 +++++++++++++++------ 3 files changed, 29 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index 801b05df1..481c0f04b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2005-12-13 David Turner + + * src/autofit/aflatin.c, src/autofit/afhints.c: changed the + implementation of the LIGHT hinting mode to completely disable + horizontal hinting. This is an experimental effort to integrate + David Chester's latest patch without fucking the other hinting + modes as well. + + Note that this doesn't force auto-hinting for all fonts however. + 2005-12-07 Werner Lemberg * src/sfnt/sfobjc.c (sfnt_init_face): Move tag check to... @@ -33,11 +43,11 @@ segments for cmap format 4. For overlapping but sorted segments, which is previously considered unsorted, we still use binary search. - * src/sfnt/ttcmap.h (TT_CMapRec_): Replace `unsorted' by `flags'. + * src/sfnt/ttcmap.h (TT_CMapRec_): Replace `unsorted' by `flags'. (TT_CMAP_FLAG_UNSORTED, TT_CMAP_FLAG_OVERLAPPED): New macros. * src/sfnt/ttcmap.c (OPT_CMAP4): Removed as it is always defined. - (TT_CMap4Rec_): Remove `old_charcode' and `table_length'. + (TT_CMap4Rec_): Remove `old_charcode' and `table_length'. (tt_cmap4_reset): Removed. (tt_cmap4_init): Updated accordingly. (tt_cmap4_next): Updated accordingly. diff --git a/src/autofit/afhints.c b/src/autofit/afhints.c index 082657126..b37ef0e26 100644 --- a/src/autofit/afhints.c +++ b/src/autofit/afhints.c @@ -509,7 +509,8 @@ af_glyph_hints_rescale( AF_GlyphHints hints, AF_ScriptMetrics metrics ) { - hints->metrics = metrics; + hints->metrics = metrics; + hints->scaler_flags = metrics->scaler.flags; } @@ -520,7 +521,6 @@ FT_Error error = AF_Err_Ok; AF_Point points; FT_UInt old_max, new_max; - AF_Scaler scaler = &hints->metrics->scaler; FT_Fixed x_scale = hints->x_scale; FT_Fixed y_scale = hints->y_scale; FT_Pos x_delta = hints->x_delta; @@ -528,7 +528,6 @@ FT_Memory memory = hints->memory; - hints->scaler_flags = scaler->flags; hints->num_points = 0; hints->num_contours = 0; diff --git a/src/autofit/aflatin.c b/src/autofit/aflatin.c index b7e04e371..8b6255763 100644 --- a/src/autofit/aflatin.c +++ b/src/autofit/aflatin.c @@ -1294,6 +1294,7 @@ AF_LatinMetrics metrics ) { FT_Render_Mode mode; + FT_UInt32 scaler_flags, other_flags; af_glyph_hints_rescale( hints, (AF_ScriptMetrics)metrics ); @@ -1308,33 +1309,41 @@ hints->y_delta = metrics->axis[AF_DIMENSION_VERT].delta; /* compute flags depending on render mode, etc... */ - mode = metrics->root.scaler.render_mode; - hints->other_flags = 0; + scaler_flags = hints->scaler_flags; + other_flags = 0; /* * We snap the width of vertical stems for the monochrome and * horizontal LCD rendering targets only. */ if ( mode == FT_RENDER_MODE_MONO || mode == FT_RENDER_MODE_LCD ) - hints->other_flags |= AF_LATIN_HINTS_HORZ_SNAP; + other_flags |= AF_LATIN_HINTS_HORZ_SNAP; /* * We snap the width of horizontal stems for the monochrome and * vertical LCD rendering targets only. */ if ( mode == FT_RENDER_MODE_MONO || mode == FT_RENDER_MODE_LCD_V ) - hints->other_flags |= AF_LATIN_HINTS_VERT_SNAP; + other_flags |= AF_LATIN_HINTS_VERT_SNAP; /* * We adjust stems to full pixels only if we don't use the `light' mode. */ if ( mode != FT_RENDER_MODE_LIGHT ) - hints->other_flags |= AF_LATIN_HINTS_STEM_ADJUST; + other_flags |= AF_LATIN_HINTS_STEM_ADJUST; if ( mode == FT_RENDER_MODE_MONO ) - hints->other_flags |= AF_LATIN_HINTS_MONO; + other_flags |= AF_LATIN_HINTS_MONO; + + /* in 'light' hinting mode, we disable horizontal hinting completely + */ + if ( mode == FT_RENDER_MODE_LIGHT ) + scaler_flags |= AF_SCALER_FLAG_NO_HORIZONTAL; + + hints->scaler_flags = scaler_flags; + hints->other_flags = other_flags; return 0; }