[truetype] Fix last `truetype' commit.
* src/truetype/ttgload.c (tt_get_metrics): Preserve stream position. Return error value. (load_truetype_glyph): Updated.
This commit is contained in:
parent
7833328b90
commit
ea5c781afa
|
@ -1,3 +1,11 @@
|
|||
2013-11-12 Werner Lemberg <wl@gnu.org>
|
||||
|
||||
[truetype] Fix last `truetype' commit.
|
||||
|
||||
* src/truetype/ttgload.c (tt_get_metrics): Preserve stream position.
|
||||
Return error value.
|
||||
(load_truetype_glyph): Updated.
|
||||
|
||||
2013-11-10 Werner Lemberg <wl@gnu.org>
|
||||
|
||||
* docs/CMAKE: New dummy file.
|
||||
|
|
|
@ -114,7 +114,7 @@
|
|||
}
|
||||
|
||||
|
||||
static void
|
||||
static FT_Error
|
||||
tt_get_metrics( TT_Loader loader,
|
||||
FT_UInt glyph_index )
|
||||
{
|
||||
|
@ -123,9 +123,16 @@
|
|||
TT_Driver driver = (TT_Driver)FT_FACE_DRIVER( face );
|
||||
#endif
|
||||
|
||||
FT_Error error;
|
||||
FT_Stream stream = loader->stream;
|
||||
|
||||
FT_Short left_bearing = 0, top_bearing = 0;
|
||||
FT_UShort advance_width = 0, advance_height = 0;
|
||||
|
||||
/* we must preserve the stream position */
|
||||
/* (which gets altered by the metrics functions) */
|
||||
FT_ULong pos = FT_STREAM_POS();
|
||||
|
||||
|
||||
TT_Get_HMetrics( face, glyph_index,
|
||||
&left_bearing,
|
||||
|
@ -135,6 +142,9 @@
|
|||
&top_bearing,
|
||||
&advance_height );
|
||||
|
||||
if ( FT_STREAM_SEEK( pos ) )
|
||||
return error;
|
||||
|
||||
loader->left_bearing = left_bearing;
|
||||
loader->advance = advance_width;
|
||||
loader->top_bearing = top_bearing;
|
||||
|
@ -157,6 +167,8 @@
|
|||
loader->linear_def = 1;
|
||||
loader->linear = advance_width;
|
||||
}
|
||||
|
||||
return FT_Err_Ok;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1452,7 +1464,9 @@
|
|||
/* the metrics must be computed after loading the glyph header */
|
||||
/* since we need the glyph's `yMax' value in case the vertical */
|
||||
/* metrics must be emulated */
|
||||
tt_get_metrics( loader, glyph_index );
|
||||
error = tt_get_metrics( loader, glyph_index );
|
||||
if ( error )
|
||||
goto Exit;
|
||||
|
||||
if ( header_only )
|
||||
goto Exit;
|
||||
|
@ -1465,7 +1479,9 @@
|
|||
loader->bbox.yMin = 0;
|
||||
loader->bbox.yMax = 0;
|
||||
|
||||
tt_get_metrics( loader, glyph_index );
|
||||
error = tt_get_metrics( loader, glyph_index );
|
||||
if ( error )
|
||||
goto Exit;
|
||||
|
||||
if ( header_only )
|
||||
goto Exit;
|
||||
|
|
Loading…
Reference in New Issue