diff options
author | 2011-02-03 21:48:23 +0000 | |
---|---|---|
committer | 2011-02-03 21:48:23 +0000 | |
commit | c3a2ae5823049f589c1841a855bb5675d69e31dd (patch) | |
tree | 24259a55dc6965099b697988297f1a730e68f9e9 | |
parent | 1aef2ed83c155509f9c46ee001bfde1eb12cd2e6 (diff) |
Improve usability of SkAdvancedTypefaceMetrics for non PDF cases.
Change the code to fill out the metrics even if the font isn't embeddable. Previously, if the font wasn't embeddable, the code would set the type to not embeddable and return without filling out the rest of the metrics.
Review URL: http://codereview.appspot.com/3973053
git-svn-id: http://skia.googlecode.com/svn/trunk@758 2bbb7eff-a529-9590-31e7-b0007b416f81
-rw-r--r-- | src/ports/SkFontHost_FreeType.cpp | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/src/ports/SkFontHost_FreeType.cpp b/src/ports/SkFontHost_FreeType.cpp index fd6af07ba4..1b1d47b5ce 100644 --- a/src/ports/SkFontHost_FreeType.cpp +++ b/src/ports/SkFontHost_FreeType.cpp @@ -449,9 +449,7 @@ SkAdvancedTypefaceMetrics* SkFontHost::GetAdvancedTypefaceMetrics( bool cid = false; const char* fontType = FT_Get_X11_Font_Format(face); - if (!canEmbed(face)) { - info->fType = SkAdvancedTypefaceMetrics::kNotEmbeddable_Font; - } else if (strcmp(fontType, "Type 1") == 0) { + if (strcmp(fontType, "Type 1") == 0) { info->fType = SkAdvancedTypefaceMetrics::kType1_Font; } else if (strcmp(fontType, "CID Type 1") == 0) { info->fType = SkAdvancedTypefaceMetrics::kType1CID_Font; @@ -468,12 +466,6 @@ SkAdvancedTypefaceMetrics* SkFontHost::GetAdvancedTypefaceMetrics( } } - if (info->fType == SkAdvancedTypefaceMetrics::kOther_Font || - info->fType == SkAdvancedTypefaceMetrics::kNotEmbeddable_Font || - !FT_IS_SCALABLE(face)) { - perGlyphInfo = false; - } - SkASSERT(!FT_HAS_VERTICAL(face)); #ifdef FT_IS_CID_KEYED SkASSERT(FT_IS_CID_KEYED(face) == @@ -550,7 +542,8 @@ SkAdvancedTypefaceMetrics* SkFontHost::GetAdvancedTypefaceMetrics( info->fBBox = SkIRect::MakeLTRB(face->bbox.xMin, face->bbox.yMax, face->bbox.xMax, face->bbox.yMin); - if (perGlyphInfo) { + if (perGlyphInfo && canEmbed(face) && FT_IS_SCALABLE(face) && + info->fType != SkAdvancedTypefaceMetrics::kOther_Font) { if (FT_IS_FIXED_WIDTH(face)) { appendRange(&info->fGlyphWidths, 0); int16_t advance = face->max_advance_width; @@ -592,6 +585,9 @@ SkAdvancedTypefaceMetrics* SkFontHost::GetAdvancedTypefaceMetrics( } } + if (!canEmbed(face)) + info->fType = SkAdvancedTypefaceMetrics::kNotEmbeddable_Font; + unref_ft_face(face); return info; } |