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

Side by Side Diff: src/ports/SkFontConfigParser_android.h

Issue 887113002: Add factory for Android font manager. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Remove no longer wanted function. Created 5 years, 10 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
« no previous file with comments | « include/ports/SkTypeface_android.h ('k') | src/ports/SkFontConfigParser_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 2011 The Android Open Source Project 2 * Copyright 2011 The Android Open Source Project
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 SKFONTCONFIGPARSER_ANDROID_H_ 8 #ifndef SKFONTCONFIGPARSER_ANDROID_H_
9 #define SKFONTCONFIGPARSER_ANDROID_H_ 9 #define SKFONTCONFIGPARSER_ANDROID_H_
10 10
11 #include "SkFontMgr_android.h"
11 #include "SkString.h" 12 #include "SkString.h"
12 #include "SkTDArray.h" 13 #include "SkTDArray.h"
13 14
14 /** \class SkLanguage 15 /** \class SkLanguage
15 16
16 The SkLanguage class represents a human written language, and is used by 17 The SkLanguage class represents a human written language, and is used by
17 text draw operations to determine which glyph to draw when drawing 18 text draw operations to determine which glyph to draw when drawing
18 characters with variants (ie Han-derived characters). 19 characters with variants (ie Han-derived characters).
19 */ 20 */
20 class SkLanguage { 21 class SkLanguage {
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 kDefault_FontVariant = 0x01, 56 kDefault_FontVariant = 0x01,
56 kCompact_FontVariant = 0x02, 57 kCompact_FontVariant = 0x02,
57 kElegant_FontVariant = 0x04, 58 kElegant_FontVariant = 0x04,
58 kLast_FontVariant = kElegant_FontVariant, 59 kLast_FontVariant = kElegant_FontVariant,
59 }; 60 };
60 typedef uint32_t FontVariant; 61 typedef uint32_t FontVariant;
61 62
62 struct FontFileInfo { 63 struct FontFileInfo {
63 FontFileInfo() : fIndex(0), fWeight(0) { } 64 FontFileInfo() : fIndex(0), fWeight(0) { }
64 65
65 SkString fFileName; 66 SkString fFileName;
66 int fIndex; 67 int fIndex;
67 int fWeight; 68 int fWeight;
68 }; 69 };
69 70
70 /** 71 /**
71 * A font family provides one or more names for a collection of fonts, each of 72 * A font family provides one or more names for a collection of fonts, each of
72 * which has a different style (normal, italic) or weight (thin, light, bold, 73 * which has a different style (normal, italic) or weight (thin, light, bold,
73 * etc). 74 * etc).
74 * Some fonts may occur in compact variants for use in the user interface. 75 * Some fonts may occur in compact variants for use in the user interface.
75 * Android distinguishes "fallback" fonts to support non-ASCII character sets. 76 * Android distinguishes "fallback" fonts to support non-ASCII character sets.
76 */ 77 */
77 struct FontFamily { 78 struct FontFamily {
78 FontFamily() 79 FontFamily(const SkString& basePath, bool isFallbackFont)
79 : fVariant(kDefault_FontVariant) 80 : fVariant(kDefault_FontVariant)
80 , fOrder(-1) 81 , fOrder(-1)
81 , fIsFallbackFont(false) { } 82 , fIsFallbackFont(isFallbackFont)
83 , fBasePath(basePath)
84 { }
82 85
83 SkTArray<SkString> fNames; 86 SkTArray<SkString> fNames;
84 SkTArray<FontFileInfo> fFonts; 87 SkTArray<FontFileInfo> fFonts;
85 SkLanguage fLanguage; 88 SkLanguage fLanguage;
86 FontVariant fVariant; 89 FontVariant fVariant;
87 int fOrder; // internal to SkFontConfigParser 90 int fOrder; // internal to SkFontConfigParser
88 bool fIsFallbackFont; 91 bool fIsFallbackFont;
92 const SkString fBasePath;
89 }; 93 };
90 94
91 namespace SkFontConfigParser { 95 namespace SkFontConfigParser {
92 96
93 /** 97 /** Parses system font configuration files and appends result to fontFamilies. * /
94 * Parses all system font configuration files and returns the results in an 98 void GetSystemFontFamilies(SkTDArray<FontFamily*>& fontFamilies);
95 * array of FontFamily structures.
96 */
97 void GetFontFamilies(SkTDArray<FontFamily*>& fontFamilies);
98 99
99 /** 100 /** Parses font configuration files and appends result to fontFamilies. */
100 * Parses all test font configuration files and returns the results in an 101 void GetCustomFontFamilies(SkTDArray<FontFamily*>& fontFamilies,
101 * array of FontFamily structures. 102 const SkString& basePath,
102 */ 103 const char* fontsXml,
103 void GetTestFontFamilies(SkTDArray<FontFamily*>& fontFamilies, 104 const char* fallbackFontsXml);
104 const char* testMainConfigFile,
105 const char* testFallbackConfigFile);
106 105
107 } // SkFontConfigParser namespace 106 } // SkFontConfigParser namespace
108 107
109 #endif /* SKFONTCONFIGPARSER_ANDROID_H_ */ 108 #endif /* SKFONTCONFIGPARSER_ANDROID_H_ */
OLDNEW
« no previous file with comments | « include/ports/SkTypeface_android.h ('k') | src/ports/SkFontConfigParser_android.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698