OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #ifndef SkRemotableFontMgr_DEFINED | 8 #ifndef SkRemotableFontMgr_DEFINED |
9 #define SkRemotableFontMgr_DEFINED | 9 #define SkRemotableFontMgr_DEFINED |
10 | 10 |
11 #include "SkFontStyle.h" | 11 #include "SkFontStyle.h" |
12 #include "SkRefCnt.h" | 12 #include "SkRefCnt.h" |
13 #include "SkTemplates.h" | 13 #include "SkTemplates.h" |
| 14 #include "SkTypes.h" |
14 | 15 |
15 class SkDataTable; | 16 class SkDataTable; |
16 class SkStreamAsset; | 17 class SkStreamAsset; |
17 class SkString; | |
18 | 18 |
19 struct SK_API SkFontIdentity { | 19 struct SK_API SkFontIdentity { |
20 static const uint32_t kInvalidDataId = 0xFFFFFFFF; | 20 static const uint32_t kInvalidDataId = 0xFFFFFFFF; |
21 | 21 |
22 // Note that fDataId is a data identifier, not a font identifier. | 22 // Note that fDataId is a data identifier, not a font identifier. |
23 // (fDataID, fTtcIndex) can be seen as a font identifier. | 23 // (fDataID, fTtcIndex) can be seen as a font identifier. |
24 uint32_t fDataId; | 24 uint32_t fDataId; |
25 uint32_t fTtcIndex; | 25 uint32_t fTtcIndex; |
26 | 26 |
27 // On Linux/FontConfig there is also the ability to specify preferences for
rendering | 27 // On Linux/FontConfig there is also the ability to specify preferences for
rendering |
28 // antialias, embedded bitmaps, autohint, hinting, hintstyle, lcd rendering | 28 // antialias, embedded bitmaps, autohint, hinting, hintstyle, lcd rendering |
29 // may all be set or set to no-preference | 29 // may all be set or set to no-preference |
30 // (No-preference is resolved against globals set by the platform) | 30 // (No-preference is resolved against globals set by the platform) |
31 // Since they may be selected against, these are really 'extensions' to SkFo
ntStyle. | 31 // Since they may be selected against, these are really 'extensions' to SkFo
ntStyle. |
32 // SkFontStyle should pick these up. | 32 // SkFontStyle should pick these up. |
33 SkFontStyle fFontStyle; | 33 SkFontStyle fFontStyle; |
34 }; | 34 }; |
35 | 35 |
36 class SK_API SkRemotableFontIdentitySet : public SkRefCnt { | 36 class SK_API SkRemotableFontIdentitySet : public SkRefCnt { |
37 public: | 37 public: |
38 | |
39 | |
40 SkRemotableFontIdentitySet(int count, SkFontIdentity** data); | 38 SkRemotableFontIdentitySet(int count, SkFontIdentity** data); |
41 | 39 |
42 int count() const { return fCount; } | 40 int count() const { return fCount; } |
43 const SkFontIdentity& at(int index) const { return fData[index]; } | 41 const SkFontIdentity& at(int index) const { return fData[index]; } |
44 | 42 |
45 static SkRemotableFontIdentitySet* NewEmpty(); | 43 static SkRemotableFontIdentitySet* NewEmpty(); |
46 | 44 |
47 private: | 45 private: |
48 SkRemotableFontIdentitySet() : fCount(0), fData() { } | 46 SkRemotableFontIdentitySet() : fCount(0), fData() { } |
49 | 47 |
50 friend SkRemotableFontIdentitySet* sk_remotable_font_identity_set_new(); | 48 friend SkRemotableFontIdentitySet* sk_remotable_font_identity_set_new(); |
51 | 49 |
52 int fCount; | 50 int fCount; |
53 SkAutoTMalloc<SkFontIdentity> fData; | 51 SkAutoTMalloc<SkFontIdentity> fData; |
54 | 52 |
55 typedef SkRefCnt INHERITED; | 53 typedef SkRefCnt INHERITED; |
56 }; | 54 }; |
57 | 55 |
58 class SK_API SkRemotableFontMgr : public SkRefCnt { | 56 class SK_API SkRemotableFontMgr : public SkRefCnt { |
59 public: | 57 public: |
60 | |
61 | |
62 /** | 58 /** |
63 * Returns the names of the known fonts on the system. | 59 * Returns the names of the known fonts on the system. |
64 * Will not return NULL, will return an empty table if no families exist. | 60 * Will not return NULL, will return an empty table if no families exist. |
65 * | 61 * |
66 * The indexes may be used with getIndex(int) and | 62 * The indexes may be used with getIndex(int) and |
67 * matchIndexStyle(int, SkFontStyle). | 63 * matchIndexStyle(int, SkFontStyle). |
68 * | 64 * |
69 * The caller must unref() the returned object. | 65 * The caller must unref() the returned object. |
70 */ | 66 */ |
71 virtual SkDataTable* getFamilyNames() const = 0; | 67 virtual SkDataTable* getFamilyNames() const = 0; |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 * | 141 * |
146 * The caller must unref() the returned object. | 142 * The caller must unref() the returned object. |
147 */ | 143 */ |
148 virtual SkStreamAsset* getData(int dataId) const = 0; | 144 virtual SkStreamAsset* getData(int dataId) const = 0; |
149 | 145 |
150 private: | 146 private: |
151 typedef SkRefCnt INHERITED; | 147 typedef SkRefCnt INHERITED; |
152 }; | 148 }; |
153 | 149 |
154 #endif | 150 #endif |
OLD | NEW |