aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/ports/SkFontHost_FreeType_common.h
diff options
context:
space:
mode:
authorGravatar bungeman <bungeman@google.com>2014-10-28 15:07:23 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2014-10-28 15:07:23 -0700
commit14df8339841f246a7337a8fb0d90f1b7ee689619 (patch)
tree50c58a7655046a2c2109683148922f775dedd7ed /src/ports/SkFontHost_FreeType_common.h
parentf2703d83da3ab2ae18b45231fd4f11e16cce3184 (diff)
Extend SkFontMgr_Custom to cover ttc, otf, pfb.
Adds ability to test ScanFont with Type1 (pfb) fonts and fonts with multiple faces (ttc). Committed: https://skia.googlesource.com/skia/+/ee0c2e4fd429424beaa35f29e7f656997ba3f115 Review URL: https://codereview.chromium.org/672723002
Diffstat (limited to 'src/ports/SkFontHost_FreeType_common.h')
-rw-r--r--src/ports/SkFontHost_FreeType_common.h15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/ports/SkFontHost_FreeType_common.h b/src/ports/SkFontHost_FreeType_common.h
index 79e6d65163..226f55d457 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)