From 03987bfdbf43a86c59702fdafe98c95cce1b208a Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Thu, 16 Oct 2014 07:19:46 +0200 Subject: [PATCH] A better fix for Savannah bug #43392. Suggested by Doug Felt . * src/sfnt/ttsbit.c (tt_sbit_decoder_load_metrics): Set `vertAdvance' to zero... * src/truetype/ttgload.c (TT_Load_Glyph): ... and set here a default value for `vertAdvance' based on `linearVertAdvance' in case `vertAdvance' is zero. Note that the previous computed ad-hoc value for `linearVertAdvance' was apparently not tested in a real-life situation. --- ChangeLog | 14 ++++++++++++++ src/sfnt/ttsbit.c | 2 +- src/truetype/ttgload.c | 11 +++++++---- 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index a71b8f027..b94ec5b48 100644 --- a/ChangeLog +++ b/ChangeLog @@ -11,6 +11,20 @@ out of range. (Ins_DELTAP, Ins_DELTAC): Optimize for legal delta_shift. +2014-10-16 Werner Lemberg + + A better fix for Savannah bug #43392. + Suggested by Doug Felt . + + * src/sfnt/ttsbit.c (tt_sbit_decoder_load_metrics): Set + `vertAdvance' to zero... + + * src/truetype/ttgload.c (TT_Load_Glyph): ... and set here a default + value for `vertAdvance' based on `linearVertAdvance' in case + `vertAdvance' is zero. Note that the previous computed ad-hoc value + for `linearVertAdvance' was apparently not tested in a real-life + situation. + 2014-10-14 David Weiß [build] Better optimization settings for vc2010 solution file. diff --git a/src/sfnt/ttsbit.c b/src/sfnt/ttsbit.c index 8899a0316..7450b4b8c 100644 --- a/src/sfnt/ttsbit.c +++ b/src/sfnt/ttsbit.c @@ -510,7 +510,7 @@ /* avoid uninitialized data in case there is no vertical info -- */ metrics->vertBearingX = 0; metrics->vertBearingY = 0; - metrics->vertAdvance = metrics->width; + metrics->vertAdvance = 0; } decoder->metrics_loaded = 1; diff --git a/src/truetype/ttgload.c b/src/truetype/ttgload.c index ff2b339c2..2ab6f76a3 100644 --- a/src/truetype/ttgload.c +++ b/src/truetype/ttgload.c @@ -2373,15 +2373,18 @@ (void)tt_loader_init( &loader, size, glyph, load_flags, TRUE ); (void)load_truetype_glyph( &loader, glyph_index, 0, TRUE ); glyph->linearHoriAdvance = loader.linear; - glyph->linearVertAdvance = loader.top_bearing + loader.bbox.yMax - - loader.vadvance; + glyph->linearVertAdvance = loader.vadvance; - /* sanity check: if `horiAdvance' in the sbit metric */ - /* structure isn't set, use `linearHoriAdvance' */ + /* sanity checks: if `xxxAdvance' in the sbit metric */ + /* structure isn't set, use `linearXXXAdvance' */ if ( !glyph->metrics.horiAdvance && glyph->linearHoriAdvance ) glyph->metrics.horiAdvance = FT_MulFix( glyph->linearHoriAdvance, size->root.metrics.x_scale ); + if ( !glyph->metrics.vertAdvance && glyph->linearVertAdvance ) + glyph->metrics.vertAdvance = + FT_MulFix( glyph->linearVertAdvance, + size->root.metrics.y_scale ); } return FT_Err_Ok;