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

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

Issue 929473002: FontFamily SkTArrays can be moved. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Add comment. 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 | « no previous file | no next file » | 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
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 }; 53 };
54 54
55 enum FontVariants { 55 enum FontVariants {
56 kDefault_FontVariant = 0x01, 56 kDefault_FontVariant = 0x01,
57 kCompact_FontVariant = 0x02, 57 kCompact_FontVariant = 0x02,
58 kElegant_FontVariant = 0x04, 58 kElegant_FontVariant = 0x04,
59 kLast_FontVariant = kElegant_FontVariant, 59 kLast_FontVariant = kElegant_FontVariant,
60 }; 60 };
61 typedef uint32_t FontVariant; 61 typedef uint32_t FontVariant;
62 62
63 // Must remain trivially movable (can be memmoved).
63 struct FontFileInfo { 64 struct FontFileInfo {
64 FontFileInfo() : fIndex(0), fWeight(0) { } 65 FontFileInfo() : fIndex(0), fWeight(0) { }
65 66
66 SkString fFileName; 67 SkString fFileName;
67 int fIndex; 68 int fIndex;
68 int fWeight; 69 int fWeight;
69 }; 70 };
70 71
71 /** 72 /**
72 * A font family provides one or more names for a collection of fonts, each of 73 * A font family provides one or more names for a collection of fonts, each of
73 * which has a different style (normal, italic) or weight (thin, light, bold, 74 * which has a different style (normal, italic) or weight (thin, light, bold,
74 * etc). 75 * etc).
75 * Some fonts may occur in compact variants for use in the user interface. 76 * Some fonts may occur in compact variants for use in the user interface.
76 * Android distinguishes "fallback" fonts to support non-ASCII character sets. 77 * Android distinguishes "fallback" fonts to support non-ASCII character sets.
77 */ 78 */
78 struct FontFamily { 79 struct FontFamily {
79 FontFamily(const SkString& basePath, bool isFallbackFont) 80 FontFamily(const SkString& basePath, bool isFallbackFont)
80 : fVariant(kDefault_FontVariant) 81 : fVariant(kDefault_FontVariant)
81 , fOrder(-1) 82 , fOrder(-1)
82 , fIsFallbackFont(isFallbackFont) 83 , fIsFallbackFont(isFallbackFont)
83 , fBasePath(basePath) 84 , fBasePath(basePath)
84 { } 85 { }
85 86
86 SkTArray<SkString> fNames; 87 SkTArray<SkString, true> fNames;
87 SkTArray<FontFileInfo> fFonts; 88 SkTArray<FontFileInfo, true> fFonts;
88 SkLanguage fLanguage; 89 SkLanguage fLanguage;
89 FontVariant fVariant; 90 FontVariant fVariant;
90 int fOrder; // internal to SkFontConfigParser 91 int fOrder; // internal to SkFontConfigParser
91 bool fIsFallbackFont; 92 bool fIsFallbackFont;
92 const SkString fBasePath; 93 const SkString fBasePath;
93 }; 94 };
94 95
95 namespace SkFontConfigParser { 96 namespace SkFontConfigParser {
96 97
97 /** Parses system font configuration files and appends result to fontFamilies. * / 98 /** Parses system font configuration files and appends result to fontFamilies. * /
98 void GetSystemFontFamilies(SkTDArray<FontFamily*>& fontFamilies); 99 void GetSystemFontFamilies(SkTDArray<FontFamily*>& fontFamilies);
99 100
100 /** Parses font configuration files and appends result to fontFamilies. */ 101 /** Parses font configuration files and appends result to fontFamilies. */
101 void GetCustomFontFamilies(SkTDArray<FontFamily*>& fontFamilies, 102 void GetCustomFontFamilies(SkTDArray<FontFamily*>& fontFamilies,
102 const SkString& basePath, 103 const SkString& basePath,
103 const char* fontsXml, 104 const char* fontsXml,
104 const char* fallbackFontsXml, 105 const char* fallbackFontsXml,
105 const char* langFallbackFontsDir = NULL); 106 const char* langFallbackFontsDir = NULL);
106 107
107 } // SkFontConfigParser namespace 108 } // SkFontConfigParser namespace
108 109
109 #endif /* SKFONTCONFIGPARSER_ANDROID_H_ */ 110 #endif /* SKFONTCONFIGPARSER_ANDROID_H_ */
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698