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

Side by Side Diff: include/ports/SkTypeface_android.h

Issue 23819067: Add new entry point that supports fallback font selection based on language. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: improvements Created 7 years, 3 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « include/core/SkPaintOptionsAndroid.h ('k') | src/ports/SkFontConfigInterface_android.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #ifdef SK_BUILD_FOR_ANDROID 14 #ifdef SK_BUILD_FOR_ANDROID
15 15
16 class SkPaintOptionsAndroid; 16 class SkPaintOptionsAndroid;
17 17
18 /** 18 /**
19 * Get the family name of the font in the fallback font list containing 19 * Get the family name of the font in the fallback font list containing
20 * the specified character. if no font is found, returns false. 20 * the specified character using the system's default language. This function
21 * also assumes the only families with the elegant or default variants will be
22 * returned.
23 *
24 * @param uni The unicode character to use for the lookup.
25 * @param name The family name of the font file containing the unicode characte r
26 * in the default language
27 * @return true if a font is found and false otherwise
21 */ 28 */
22 SK_API bool SkGetFallbackFamilyNameForChar(SkUnichar uni, SkString* name); 29 SK_API bool SkGetFallbackFamilyNameForChar(SkUnichar uni, SkString* name);
23 30
24 /** 31 /**
32 * Get the family name of the font in the fallback font list containing
33 * the specified character taking into account the provided language. This
34 * function also assumes the only families with the elegant or default variants
35 * will be returned.
36 *
37 * @param uni The unicode character to use for the lookup.
38 * @param lang The null terminated string representing the BCP 47 language
39 * identifier for the preferred language
40 * @param name The family name of the font file containing the unicode characte r
41 * in the preferred language
42 * @return true if a font is found and false otherwise
43 */
44 SK_API bool SkGetFallbackFamilyNameForChar(SkUnichar uni, const char* lang, SkSt ring* name);
45
46 /**
25 * For test only. 47 * For test only.
26 * Load font config from given xml files, instead of those from Android system. 48 * Load font config from given xml files, instead of those from Android system.
27 */ 49 */
28 SK_API void SkUseTestFontConfigFile(const char* mainconf, const char* fallbackco nf, 50 SK_API void SkUseTestFontConfigFile(const char* mainconf, const char* fallbackco nf,
29 const char* fontsdir); 51 const char* fontsdir);
30 52
31 /** 53 /**
32 * Given a "current" fontID, return a ref to the next logical typeface 54 * Given a "current" fontID, return a ref to the next logical typeface
33 * when searching fonts for a given unicode value. Typically the caller 55 * when searching fonts for a given unicode value. Typically the caller
34 * will query a given font, and if a unicode value is not supported, they 56 * will query a given font, and if a unicode value is not supported, they
(...skipping 28 matching lines...) Expand all
63 * unref() when they are done. 85 * unref() when they are done.
64 */ 86 */
65 SK_API SkTypeface* SkCreateTypefaceForScriptNG(hb_script_t script, SkTypeface::S tyle style, 87 SK_API SkTypeface* SkCreateTypefaceForScriptNG(hb_script_t script, SkTypeface::S tyle style,
66 SkPaintOptionsAndroid::FontVariant fontVariant = SkPaintOptionsAndroid:: kDefault_Variant); 88 SkPaintOptionsAndroid::FontVariant fontVariant = SkPaintOptionsAndroid:: kDefault_Variant);
67 89
68 SK_API SkTypeface* SkCreateTypefaceForScript(HB_Script script, SkTypeface::Style style, 90 SK_API SkTypeface* SkCreateTypefaceForScript(HB_Script script, SkTypeface::Style style,
69 SkPaintOptionsAndroid::FontVariant fontVariant = SkPaintOptionsAndroid:: kDefault_Variant); 91 SkPaintOptionsAndroid::FontVariant fontVariant = SkPaintOptionsAndroid:: kDefault_Variant);
70 92
71 #endif // #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK 93 #endif // #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK
72 #endif // #ifndef SkTypeface_android_DEFINED 94 #endif // #ifndef SkTypeface_android_DEFINED
OLDNEW
« no previous file with comments | « include/core/SkPaintOptionsAndroid.h ('k') | src/ports/SkFontConfigInterface_android.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698