Make onCreateFromStream check that the stream looks like a font.
git-svn-id: http://skia.googlecode.com/svn/trunk@12224 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
parent
af35641762
commit
0cd74ad38a
@ -18,6 +18,10 @@
|
||||
#include <fontconfig/fontconfig.h>
|
||||
#include <unistd.h>
|
||||
|
||||
// Defined in SkFontHost_FreeType.cpp
|
||||
bool find_name_and_attributes(SkStream* stream, SkString* name,
|
||||
SkTypeface::Style* style, bool* isFixedWidth);
|
||||
|
||||
// borrow this global from SkFontHost_fontconfig. eventually that file should
|
||||
// go away, and be replaced with this one.
|
||||
extern SkFontConfigInterface* SkFontHost_fontconfig_ref_global();
|
||||
@ -274,7 +278,12 @@ protected:
|
||||
|
||||
// TODO should the caller give us the style or should we get it from freetype?
|
||||
SkTypeface::Style style = SkTypeface::kNormal;
|
||||
SkTypeface* face = SkNEW_ARGS(FontConfigTypeface, (style, false, 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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user