OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 | 8 |
9 #ifndef SkTypeface_android_DEFINED | 9 #ifndef SkTypeface_android_DEFINED |
10 #define SkTypeface_android_DEFINED | 10 #define SkTypeface_android_DEFINED |
11 | 11 |
12 #include "SkTypeface.h" | 12 #include "SkTypeface.h" |
13 | 13 |
14 enum FallbackScripts { | |
15 kArabic_FallbackScript, | |
16 kArmenian_FallbackScript, | |
17 kBengali_FallbackScript, | |
18 kDevanagari_FallbackScript, | |
19 kEthiopic_FallbackScript, | |
20 kGeorgian_FallbackScript, | |
21 kHebrewRegular_FallbackScript, | |
22 kHebrewBold_FallbackScript, | |
23 kKannada_FallbackScript, | |
24 kMalayalam_FallbackScript, | |
25 kTamilRegular_FallbackScript, | |
26 kTamilBold_FallbackScript, | |
27 kThai_FallbackScript, | |
28 kTelugu_FallbackScript, | |
29 kFallbackScriptNumber | |
30 }; | |
31 | |
32 // This particular mapping will be removed after WebKit is updated to use the | |
33 // new mappings. No new caller should use the kTamil_FallbackScript but rather | |
34 // the more specific Tamil scripts in the standard enum. | |
35 #define kTamil_FallbackScript kTamilRegular_FallbackScript | |
36 | |
37 #define SkTypeface_ValidScript(s) (s >= 0 && s < kFallbackScriptNumber) | |
38 | |
39 /** | |
40 * Return a new typeface for a fallback script. If the script is | |
41 * not valid, or can not map to a font, returns null. | |
42 * @param script The script id. | |
43 * @return reference to the matching typeface. Caller must call | |
44 * unref() when they are done. | |
45 */ | |
46 SK_API SkTypeface* SkCreateTypefaceForScript(FallbackScripts script); | |
47 | |
48 /** | |
49 * Return the string representation for the fallback script on Android. | |
50 * If the script is not valid, returns null. | |
51 */ | |
52 SK_API const char* SkGetFallbackScriptID(FallbackScripts script); | |
53 | |
54 /** | |
55 * Return the fallback script enum for the ID on Android. | |
56 * If the ID is not valid, or can not map to a fallback | |
57 * script, returns kFallbackScriptNumber. | |
58 */ | |
59 SK_API FallbackScripts SkGetFallbackScriptFromID(const char* id); | |
60 | |
61 /** | |
62 * Return a new typeface of the font in the fallback font list containing | |
63 * the specified chararacter. If no typeface is found, returns null. | |
64 */ | |
65 SK_API SkTypeface* SkCreateFallbackTypefaceForChar(SkUnichar uni, | |
66 SkTypeface::Style style); | |
67 | |
68 /** | 14 /** |
69 * Get the family name of the font in the fallback font list containing | 15 * Get the family name of the font in the fallback font list containing |
70 * the specified chararacter. if no font is found, returns false. | 16 * the specified chararacter. if no font is found, returns false. |
71 */ | 17 */ |
72 SK_API bool SkGetFallbackFamilyNameForChar(SkUnichar uni, SkString* name); | 18 SK_API bool SkGetFallbackFamilyNameForChar(SkUnichar uni, SkString* name); |
73 | 19 |
74 /** | 20 /** |
75 * For test only. | 21 * For test only. |
76 * Load font config from given xml files, instead of those from Android system. | 22 * Load font config from given xml files, instead of those from Android system. |
77 */ | 23 */ |
(...skipping 11 matching lines...) Expand all Loading... |
89 * The original fontID is also provided. This is the initial font that was | 35 * The original fontID is also provided. This is the initial font that was |
90 * stored in the typeface of the caller. It is provided as an aid to choose | 36 * stored in the typeface of the caller. It is provided as an aid to choose |
91 * the best next logical font. e.g. If the original font was bold or serif, | 37 * the best next logical font. e.g. If the original font was bold or serif, |
92 * but the 2nd in the logical chain was plain, then a subsequent call to | 38 * but the 2nd in the logical chain was plain, then a subsequent call to |
93 * get the 3rd can still inspect the original, and try to match its | 39 * get the 3rd can still inspect the original, and try to match its |
94 * stylistic attributes. | 40 * stylistic attributes. |
95 */ | 41 */ |
96 SkTypeface* SkAndroidNextLogicalTypeface(SkFontID currFontID, SkFontID origFontI
D); | 42 SkTypeface* SkAndroidNextLogicalTypeface(SkFontID currFontID, SkFontID origFontI
D); |
97 | 43 |
98 #endif | 44 #endif |
OLD | NEW |