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

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

Issue 450513002: Revert "Remove SkPaintOptionsAndroid" (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 4 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 | « src/ports/SkFontConfigInterface_android.cpp ('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 "SkTypes.h"
12
13 #include "SkPaintOptionsAndroid.h"
11 #include "SkString.h" 14 #include "SkString.h"
12 #include "SkTDArray.h" 15 #include "SkTDArray.h"
13 16
14 /** \class SkLanguage
15
16 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 characters with variants (ie Han-derived characters).
19 */
20 class SkLanguage {
21 public:
22 SkLanguage() { }
23 SkLanguage(const SkString& tag) : fTag(tag) { }
24 SkLanguage(const char* tag) : fTag(tag) { }
25 SkLanguage(const char* tag, size_t len) : fTag(tag, len) { }
26 SkLanguage(const SkLanguage& b) : fTag(b.fTag) { }
27
28 /** Gets a BCP 47 language identifier for this SkLanguage.
29 @return a BCP 47 language identifier representing this language
30 */
31 const SkString& getTag() const { return fTag; }
32
33 /** Performs BCP 47 fallback to return an SkLanguage one step more general.
34 @return an SkLanguage one step more general
35 */
36 SkLanguage getParent() const;
37
38 bool operator==(const SkLanguage& b) const {
39 return fTag == b.fTag;
40 }
41 bool operator!=(const SkLanguage& b) const {
42 return fTag != b.fTag;
43 }
44 SkLanguage& operator=(const SkLanguage& b) {
45 fTag = b.fTag;
46 return *this;
47 }
48
49 private:
50 //! BCP 47 language identifier
51 SkString fTag;
52 };
53
54 enum FontVariants {
55 kDefault_FontVariant = 0x01,
56 kCompact_FontVariant = 0x02,
57 kElegant_FontVariant = 0x04,
58 kLast_FontVariant = kElegant_FontVariant,
59 };
60 typedef uint32_t FontVariant;
61
62 struct FontFileInfo { 17 struct FontFileInfo {
63 FontFileInfo() : fIndex(0), fWeight(0) { } 18 FontFileInfo() : fIndex(0), fWeight(0) { }
64 19
65 SkString fFileName; 20 SkString fFileName;
66 int fIndex; 21 int fIndex;
22 SkPaintOptionsAndroid fPaintOptions;
67 int fWeight; 23 int fWeight;
68 }; 24 };
69 25
70 /** 26 /**
71 * The FontFamily data structure is created during parsing and handed back to 27 * The FontFamily data structure is created during parsing and handed back to
72 * Skia to fold into its representation of font families. fNames is the list of 28 * Skia to fold into its representation of font families. fNames is the list of
73 * font names that alias to a font family. fontFileArray is the list of informat ion 29 * font names that alias to a font family. fontFileArray is the list of informat ion
74 * about each file. Order is the priority order for the font. This is 30 * about each file. Order is the priority order for the font. This is
75 * used internally to determine the order in which to place fallback fonts as 31 * used internally to determine the order in which to place fallback fonts as
76 * they are read from the configuration files. 32 * they are read from the configuration files.
77 */ 33 */
78 struct FontFamily { 34 struct FontFamily {
79 FontFamily() 35 FontFamily()
80 : fVariant(kDefault_FontVariant) 36 : fVariant(SkPaintOptionsAndroid::kDefault_Variant)
81 , order(-1) 37 , order(-1)
82 , fIsFallbackFont(false) { } 38 , fIsFallbackFont(false) { }
83 39
84 SkTArray<SkString> fNames; 40 SkTArray<SkString> fNames;
85 SkTArray<FontFileInfo> fFontFiles; 41 SkTArray<FontFileInfo> fFontFiles;
86 SkLanguage fLanguage; 42 SkLanguage fLanguage;
87 FontVariant fVariant; 43 SkPaintOptionsAndroid::FontVariant fVariant;
88 int order; // only used internally by SkFontC onfigParser 44 int order; // only used internally by SkFontC onfigParser
89 bool fIsFallbackFont; 45 bool fIsFallbackFont;
90 }; 46 };
91 47
92 namespace SkFontConfigParser { 48 namespace SkFontConfigParser {
93 49
94 /** 50 /**
95 * Parses all system font configuration files and returns the results in an 51 * Parses all system font configuration files and returns the results in an
96 * array of FontFamily structures. 52 * array of FontFamily structures.
97 */ 53 */
98 void GetFontFamilies(SkTDArray<FontFamily*> &fontFamilies); 54 void GetFontFamilies(SkTDArray<FontFamily*> &fontFamilies);
99 55
100 /** 56 /**
101 * Parses all test font configuration files and returns the results in an 57 * Parses all test font configuration files and returns the results in an
102 * array of FontFamily structures. 58 * array of FontFamily structures.
103 */ 59 */
104 void GetTestFontFamilies(SkTDArray<FontFamily*> &fontFamilies, 60 void GetTestFontFamilies(SkTDArray<FontFamily*> &fontFamilies,
105 const char* testMainConfigFile, 61 const char* testMainConfigFile,
106 const char* testFallbackConfigFile); 62 const char* testFallbackConfigFile);
107 63
108 } // SkFontConfigParser namespace 64 } // SkFontConfigParser namespace
109 65
110 #endif /* SKFONTCONFIGPARSER_ANDROID_H_ */ 66 #endif /* SKFONTCONFIGPARSER_ANDROID_H_ */
OLDNEW
« no previous file with comments | « src/ports/SkFontConfigInterface_android.cpp ('k') | src/ports/SkFontConfigParser_android.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698