[truetype] Speed up `TT_Load_Glyph'.
This avoids additional calls to `tt_face_lookup_table' for the `glyf' table, which can be expensive. * include/freetype/internal/tttypes.h (TT_LoaderRec): Move `glyf_offset' field to ... (TT_FaceRec): ... this structure. * src/truetype/ttgload.c (load_truetype_glyph): Updated. (tt_loader_init): Move initialization of `glyf_offset' to ... * src/truetype/ttpload.c (tt_face_load_loca): .. this function.
This commit is contained in:
parent
0d94592942
commit
e27b8a5598
14
ChangeLog
14
ChangeLog
@ -1,3 +1,17 @@
|
||||
2016-09-27 Werner Lemberg <wl@gnu.org>
|
||||
|
||||
[truetype] Speed up `TT_Load_Glyph'.
|
||||
|
||||
This avoids additional calls to `tt_face_lookup_table' for the
|
||||
`glyf' table, which can be expensive.
|
||||
|
||||
* include/freetype/internal/tttypes.h (TT_LoaderRec): Move
|
||||
`glyf_offset' field to ...
|
||||
(TT_FaceRec): ... this structure.
|
||||
* src/truetype/ttgload.c (load_truetype_glyph): Updated.
|
||||
(tt_loader_init): Move initialization of `glyf_offset' to ...
|
||||
* src/truetype/ttpload.c (tt_face_load_loca): .. this function.
|
||||
|
||||
2016-09-27 Werner Lemberg <wl@gnu.org>
|
||||
|
||||
[truetype] Introduce dynamic limits for some bytecode opcodes.
|
||||
|
@ -1344,6 +1344,7 @@ FT_BEGIN_HEADER
|
||||
const char* postscript_name;
|
||||
|
||||
FT_ULong glyf_len;
|
||||
FT_ULong glyf_offset; /* since 2.7.1 */
|
||||
|
||||
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
|
||||
FT_Bool doblend;
|
||||
@ -1492,8 +1493,6 @@ FT_BEGIN_HEADER
|
||||
FT_Vector pp1;
|
||||
FT_Vector pp2;
|
||||
|
||||
FT_ULong glyf_offset;
|
||||
|
||||
/* the zone where we load our glyphs */
|
||||
TT_GlyphZoneRec base;
|
||||
TT_GlyphZoneRec zone;
|
||||
|
@ -1505,10 +1505,10 @@
|
||||
{
|
||||
#ifdef FT_CONFIG_OPTION_INCREMENTAL
|
||||
/* for the incremental interface, `glyf_offset' is always zero */
|
||||
if ( !loader->glyf_offset &&
|
||||
if ( !face->glyf_offset &&
|
||||
!face->root.internal->incremental_interface )
|
||||
#else
|
||||
if ( !loader->glyf_offset )
|
||||
if ( !face->glyf_offset )
|
||||
#endif /* FT_CONFIG_OPTION_INCREMENTAL */
|
||||
{
|
||||
FT_TRACE2(( "no `glyf' table but non-zero `loca' entry\n" ));
|
||||
@ -1517,7 +1517,7 @@
|
||||
}
|
||||
|
||||
error = face->access_glyph_frame( loader, glyph_index,
|
||||
loader->glyf_offset + offset,
|
||||
face->glyf_offset + offset,
|
||||
(FT_UInt)loader->byte_len );
|
||||
if ( error )
|
||||
goto Exit;
|
||||
@ -2497,32 +2497,6 @@
|
||||
|
||||
#endif /* TT_USE_BYTECODE_INTERPRETER */
|
||||
|
||||
/* seek to the beginning of the glyph table -- for Type 42 fonts */
|
||||
/* the table might be accessed from a Postscript stream or something */
|
||||
/* else... */
|
||||
|
||||
#ifdef FT_CONFIG_OPTION_INCREMENTAL
|
||||
|
||||
if ( face->root.internal->incremental_interface )
|
||||
loader->glyf_offset = 0;
|
||||
else
|
||||
|
||||
#endif
|
||||
|
||||
{
|
||||
error = face->goto_table( face, TTAG_glyf, stream, 0 );
|
||||
|
||||
if ( FT_ERR_EQ( error, Table_Missing ) )
|
||||
loader->glyf_offset = 0;
|
||||
else if ( error )
|
||||
{
|
||||
FT_ERROR(( "tt_loader_init: could not access glyph table\n" ));
|
||||
return error;
|
||||
}
|
||||
else
|
||||
loader->glyf_offset = FT_STREAM_POS();
|
||||
}
|
||||
|
||||
/* get face's glyph loader */
|
||||
if ( !glyf_table_only )
|
||||
{
|
||||
|
@ -73,9 +73,22 @@
|
||||
/* it is possible that a font doesn't have a glyf table at all */
|
||||
/* or its size is zero */
|
||||
if ( FT_ERR_EQ( error, Table_Missing ) )
|
||||
face->glyf_len = 0;
|
||||
{
|
||||
face->glyf_len = 0;
|
||||
face->glyf_offset = 0;
|
||||
}
|
||||
else if ( error )
|
||||
goto Exit;
|
||||
else
|
||||
{
|
||||
#ifdef FT_CONFIG_OPTION_INCREMENTAL
|
||||
if ( face->root.internal->incremental_interface )
|
||||
face->glyf_offset = 0;
|
||||
else
|
||||
#endif
|
||||
face->glyf_offset = FT_STREAM_POS();
|
||||
}
|
||||
|
||||
|
||||
FT_TRACE2(( "Locations " ));
|
||||
error = face->goto_table( face, TTAG_loca, stream, &table_len );
|
||||
|
Loading…
Reference in New Issue
Block a user