Index: src/ports/SkFontHost_fontconfig.cpp |
diff --git a/src/ports/SkFontHost_fontconfig.cpp b/src/ports/SkFontHost_fontconfig.cpp |
index 1625b8aa81527b4edfc66feeb5d571bf67381b8c..012ce90c8cdf9f7525da8be9c12e09353061e0a1 100644 |
--- a/src/ports/SkFontHost_fontconfig.cpp |
+++ b/src/ports/SkFontHost_fontconfig.cpp |
@@ -15,6 +15,13 @@ |
#include "SkTypeface.h" |
#include "SkTypefaceCache.h" |
+// Defined in SkFontHost_FreeType.cpp |
+bool find_name_and_attributes(SkStream* stream, SkString* name, |
+ SkTypeface::Style* style, bool* isFixedWidth); |
+ |
+/////////////////////////////////////////////////////////////////////////////// |
+/////////////////////////////////////////////////////////////////////////////// |
+ |
SK_DECLARE_STATIC_MUTEX(gFontConfigInterfaceMutex); |
static SkFontConfigInterface* gFontConfigInterface; |
@@ -129,9 +136,14 @@ SkTypeface* SkFontHost::CreateTypefaceFromStream(SkStream* stream) { |
return NULL; // don't accept too large fonts (>= 1GB) for safety. |
} |
- // TODO should the caller give us the style? |
+ // ask freetype for reported style and if it is a fixed width font |
SkTypeface::Style style = SkTypeface::kNormal; |
- SkTypeface* face = SkNEW_ARGS(FontConfigTypeface, (style, stream)); |
+ bool isFixedWidth = false; |
+ if (!find_name_and_attributes(stream, NULL, &style, &isFixedWidth)) { |
+ return NULL; |
+ } |
+ |
+ SkTypeface* face = SkNEW_ARGS(FontConfigTypeface, (style, isFixedWidth, stream)); |
return face; |
} |