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

Unified Diff: src/ports/SkFontHost_FreeType_common.h

Issue 672723002: Extend SkFontMgr_Custom to cover ttc, otf, pfb. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Keep FT_Stream alive, protect library with mutex. Created 6 years, 2 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/SkFontHost_FreeType.cpp ('k') | src/ports/SkFontHost_linux.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ports/SkFontHost_FreeType_common.h
diff --git a/src/ports/SkFontHost_FreeType_common.h b/src/ports/SkFontHost_FreeType_common.h
index 79e6d651631103642729c4788fc55f8b3bf2ec5b..226f55d45741bdd92663d2a7833c1a6e1ddba2c2 100644
--- a/src/ports/SkFontHost_FreeType_common.h
+++ b/src/ports/SkFontHost_FreeType_common.h
@@ -12,6 +12,7 @@
#include "SkGlyph.h"
#include "SkScalerContext.h"
#include "SkTypeface.h"
+#include "SkTypes.h"
#include <ft2build.h>
#include FT_FREETYPE_H
@@ -48,8 +49,18 @@ public:
/** For SkFontMgrs to make use of our ability to extract
* name and style from a stream, using FreeType's API.
*/
- static bool ScanFont(SkStream* stream, int ttcIndex,
- SkString* name, SkFontStyle* style, bool* isFixedPitch);
+ class Scanner : ::SkNoncopyable {
+ public:
+ Scanner();
+ ~Scanner();
+ bool recognizedFont(SkStream* stream, int* numFonts) const;
+ bool scanFont(SkStream* stream, int ttcIndex,
+ SkString* name, SkFontStyle* style, bool* isFixedPitch) const;
+ private:
+ FT_Face openFace(SkStream* stream, int ttcIndex, FT_Stream ftStream) const;
+ FT_Library fLibrary;
+ mutable SkMutex fLibraryMutex;
+ };
protected:
SkTypeface_FreeType(const SkFontStyle& style, SkFontID uniqueID, bool isFixedPitch)
« no previous file with comments | « src/ports/SkFontHost_FreeType.cpp ('k') | src/ports/SkFontHost_linux.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698