A better fix for Savannah bug #43392.

Suggested by Doug Felt <dougfelt@gmail.com>.

* 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.
This commit is contained in:
Werner Lemberg 2014-10-16 07:19:46 +02:00
parent 7e83f06804
commit 03987bfdbf
3 changed files with 22 additions and 5 deletions

View File

@ -11,6 +11,20 @@
out of range.
(Ins_DELTAP, Ins_DELTAC): Optimize for legal delta_shift.
2014-10-16 Werner Lemberg <wl@gnu.org>
A better fix for Savannah bug #43392.
Suggested by Doug Felt <dougfelt@gmail.com>.
* 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ß <David.Weiss@ptvgroup.com>
[build] Better optimization settings for vc2010 solution file.

View File

@ -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;

View File

@ -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;