Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(898)

Unified Diff: src/ports/SkFontHost_fontconfig.cpp

Issue 23966003: Update the freetype backed fonthost to keep the style and fixed width attributes for a font stream. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: updating per comments Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/ports/SkFontConfigTypeface.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
« no previous file with comments | « src/ports/SkFontConfigTypeface.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698