OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2006-2012 The Android Open Source Project | 2 * Copyright 2006-2012 The Android Open Source Project |
3 * Copyright 2012 Mozilla Foundation | 3 * Copyright 2012 Mozilla Foundation |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 #ifndef SKFONTHOST_FREETYPE_COMMON_H_ | 9 #ifndef SKFONTHOST_FREETYPE_COMMON_H_ |
10 #define SKFONTHOST_FREETYPE_COMMON_H_ | 10 #define SKFONTHOST_FREETYPE_COMMON_H_ |
(...skipping 25 matching lines...) Expand all Loading... |
36 | 36 |
37 class SkTypeface_FreeType : public SkTypeface { | 37 class SkTypeface_FreeType : public SkTypeface { |
38 public: | 38 public: |
39 /** For SkFontMgrs to make use of our ability to extract | 39 /** For SkFontMgrs to make use of our ability to extract |
40 * name and style from a stream, using FreeType's API. | 40 * name and style from a stream, using FreeType's API. |
41 */ | 41 */ |
42 class Scanner : ::SkNoncopyable { | 42 class Scanner : ::SkNoncopyable { |
43 public: | 43 public: |
44 Scanner(); | 44 Scanner(); |
45 ~Scanner(); | 45 ~Scanner(); |
46 struct AxisDefinition { | |
47 SkFourByteTag fTag; | |
48 SkFixed fMinimum; | |
49 SkFixed fDefault; | |
50 SkFixed fMaximum; | |
51 }; | |
52 using AxisDefinitions = SkSTArray<4, AxisDefinition, true>; | |
53 bool recognizedFont(SkStream* stream, int* numFonts) const; | 46 bool recognizedFont(SkStream* stream, int* numFonts) const; |
54 bool scanFont(SkStream* stream, int ttcIndex, | 47 bool scanFont(SkStream* stream, int ttcIndex, |
55 SkString* name, SkFontStyle* style, bool* isFixedPitch, | 48 SkString* name, SkFontStyle* style, bool* isFixedPitch) co
nst; |
56 AxisDefinitions* axes) const; | |
57 private: | 49 private: |
58 FT_Face openFace(SkStream* stream, int ttcIndex, FT_Stream ftStream) con
st; | 50 FT_Face openFace(SkStream* stream, int ttcIndex, FT_Stream ftStream) con
st; |
59 FT_Library fLibrary; | 51 FT_Library fLibrary; |
60 mutable SkMutex fLibraryMutex; | 52 mutable SkMutex fLibraryMutex; |
61 }; | 53 }; |
62 | 54 |
63 protected: | 55 protected: |
64 SkTypeface_FreeType(const SkFontStyle& style, SkFontID uniqueID, bool isFixe
dPitch) | 56 SkTypeface_FreeType(const SkFontStyle& style, SkFontID uniqueID, bool isFixe
dPitch) |
65 : INHERITED(style, uniqueID, isFixedPitch) | 57 : INHERITED(style, uniqueID, isFixedPitch) |
66 , fGlyphCount(-1) | 58 , fGlyphCount(-1) |
(...skipping 17 matching lines...) Expand all Loading... |
84 virtual size_t onGetTableData(SkFontTableTag, size_t offset, | 76 virtual size_t onGetTableData(SkFontTableTag, size_t offset, |
85 size_t length, void* data) const override; | 77 size_t length, void* data) const override; |
86 | 78 |
87 private: | 79 private: |
88 mutable int fGlyphCount; | 80 mutable int fGlyphCount; |
89 | 81 |
90 typedef SkTypeface INHERITED; | 82 typedef SkTypeface INHERITED; |
91 }; | 83 }; |
92 | 84 |
93 #endif // SKFONTHOST_FREETYPE_COMMON_H_ | 85 #endif // SKFONTHOST_FREETYPE_COMMON_H_ |
OLD | NEW |