From 552a956247bb35cc8b7c0fb2371a3f8011a5bb29 Mon Sep 17 00:00:00 2001 From: David Turner Date: Mon, 28 May 2007 15:45:35 +0000 Subject: [PATCH] optimize CFF glyph loader (avoid apply identity font transform) --- ChangeLog | 4 ++++ src/cff/cffgload.c | 14 ++++++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index c75f2b64c..aaee4f555 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2007-05-28 David Turner + * src/cff/cffgload.c: do not apply the font transform to loaded glyph + if it is the identity. this cuts a significant percent of CFF glyph + loading time + * src/autofit/afglobal.c: change default hinting script to CJK, since it works well with a larger array of scripts. thanks to "Rahul Bhalerao" for pointing this out ! diff --git a/src/cff/cffgload.c b/src/cff/cffgload.c index 4c20a684f..d38d6838b 100644 --- a/src/cff/cffgload.c +++ b/src/cff/cffgload.c @@ -2281,6 +2281,7 @@ FT_Bool hinting; CFF_Font cff = (CFF_Font)face->extra.data; + FT_Bool use_font_matrix; FT_Matrix font_matrix; FT_Vector font_offset; @@ -2547,11 +2548,16 @@ glyph->root.outline.flags |= FT_OUTLINE_REVERSE_FILL; /* apply the font matrix */ - FT_Outline_Transform( &glyph->root.outline, &font_matrix ); + if ( font_matrix.xx != 0x10000 && font_matrix.yy != 0x10000 && + font_matrix.xy != 0 && font_matrix.yx != 0 ) + { + FT_Outline_Transform( &glyph->root.outline, &font_matrix ); + } - FT_Outline_Translate( &glyph->root.outline, - font_offset.x, - font_offset.y ); + if ( font_offset.x != 0 || font_offset.y != 0 ) + FT_Outline_Translate( &glyph->root.outline, + font_offset.x, + font_offset.y ); advance.x = metrics->horiAdvance; advance.y = 0;