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

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

Issue 447873003: 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
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"
14 #include "SkString.h" 11 #include "SkString.h"
15 #include "SkTDArray.h" 12 #include "SkTDArray.h"
16 13
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
17 struct FontFileInfo { 62 struct FontFileInfo {
18 FontFileInfo() : fIndex(0), fWeight(0) { } 63 FontFileInfo() : fIndex(0), fWeight(0) { }
19 64
20 SkString fFileName; 65 SkString fFileName;
21 int fIndex; 66 int fIndex;
22 SkPaintOptionsAndroid fPaintOptions;
23 int fWeight; 67 int fWeight;
24 }; 68 };
25 69
26 /** 70 /**
27 * The FontFamily data structure is created during parsing and handed back to 71 * The FontFamily data structure is created during parsing and handed back to
28 * Skia to fold into its representation of font families. fNames is the list of 72 * Skia to fold into its representation of font families. fNames is the list of
29 * font names that alias to a font family. fontFileArray is the list of informat ion 73 * font names that alias to a font family. fontFileArray is the list of informat ion
30 * about each file. Order is the priority order for the font. This is 74 * about each file. Order is the priority order for the font. This is
31 * used internally to determine the order in which to place fallback fonts as 75 * used internally to determine the order in which to place fallback fonts as
32 * they are read from the configuration files. 76 * they are read from the configuration files.
33 */ 77 */
34 struct FontFamily { 78 struct FontFamily {
35 FontFamily() 79 FontFamily()
36 : fVariant(SkPaintOptionsAndroid::kDefault_Variant) 80 : fVariant(kDefault_FontVariant)
37 , order(-1) 81 , order(-1)
38 , fIsFallbackFont(false) { } 82 , fIsFallbackFont(false) { }
39 83
40 SkTArray<SkString> fNames; 84 SkTArray<SkString> fNames;
41 SkTArray<FontFileInfo> fFontFiles; 85 SkTArray<FontFileInfo> fFontFiles;
42 SkLanguage fLanguage; 86 SkLanguage fLanguage;
43 SkPaintOptionsAndroid::FontVariant fVariant; 87 FontVariant fVariant;
44 int order; // only used internally by SkFontC onfigParser 88 int order; // only used internally by SkFontC onfigParser
45 bool fIsFallbackFont; 89 bool fIsFallbackFont;
46 }; 90 };
47 91
48 namespace SkFontConfigParser { 92 namespace SkFontConfigParser {
49 93
94
95
50 /** 96 /**
51 * Parses all system font configuration files and returns the results in an 97 * Parses all system font configuration files and returns the results in an
52 * array of FontFamily structures. 98 * array of FontFamily structures.
53 */ 99 */
54 void GetFontFamilies(SkTDArray<FontFamily*> &fontFamilies); 100 void GetFontFamilies(SkTDArray<FontFamily*> &fontFamilies);
55 101
56 /** 102 /**
57 * Parses all test font configuration files and returns the results in an 103 * Parses all test font configuration files and returns the results in an
58 * array of FontFamily structures. 104 * array of FontFamily structures.
59 */ 105 */
60 void GetTestFontFamilies(SkTDArray<FontFamily*> &fontFamilies, 106 void GetTestFontFamilies(SkTDArray<FontFamily*> &fontFamilies,
61 const char* testMainConfigFile, 107 const char* testMainConfigFile,
62 const char* testFallbackConfigFile); 108 const char* testFallbackConfigFile);
63 109
64 } // SkFontConfigParser namespace 110 } // SkFontConfigParser namespace
65 111
66 #endif /* SKFONTCONFIGPARSER_ANDROID_H_ */ 112 #endif /* SKFONTCONFIGPARSER_ANDROID_H_ */
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698