Handle failure of GetAdvancedTypefaceMetrics gracefully until we can figure out why it is failing.
Code from arthurhsu@chromium.org. Original CL: http://codereview.appspot.com/5276057/
Review URL: http://codereview.appspot.com/5274051
git-svn-id: http://skia.googlecode.com/svn/trunk@2480 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/pdf/SkPDFFont.cpp b/src/pdf/SkPDFFont.cpp
index fe55c8d..5d358cb 100644
--- a/src/pdf/SkPDFFont.cpp
+++ b/src/pdf/SkPDFFont.cpp
@@ -759,7 +759,6 @@
SkPDFDict* relatedFontDescriptor = NULL;
if (relatedFontIndex >= 0) {
SkPDFFont* relatedFont = CanonicalFonts()[relatedFontIndex].fFont;
- SkASSERT(relatedFont->fFontInfo.get());
fontMetrics = relatedFont->fontInfo();
relatedFontDescriptor = relatedFont->getFontDescriptor();
} else {
@@ -775,7 +774,8 @@
SkFontHost::GetAdvancedTypefaceMetrics(fontID, info, NULL, 0);
#if defined (SK_SFNTLY_SUBSETTER)
SkSafeUnref(fontMetrics.get()); // SkRefPtr and Get both took a ref.
- if (fontMetrics->fType != SkAdvancedTypefaceMetrics::kTrueType_Font) {
+ if (fontMetrics &&
+ fontMetrics->fType != SkAdvancedTypefaceMetrics::kTrueType_Font) {
// Font does not support subsetting, get new info with advance.
info = SkTBitOr<SkAdvancedTypefaceMetrics::PerGlyphInfo>(
info, SkAdvancedTypefaceMetrics::kHAdvance_PerGlyphInfo);