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

Side by Side Diff: third_party/WebKit/Source/platform/fonts/FontPlatformData.h

Issue 1931393002: Introduce typeface cache in blink::FontCache (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: wip: others Created 4 years, 7 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 (c) 2006, 2007, 2008, Google Inc. All rights reserved. 2 * Copyright (c) 2006, 2007, 2008, Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 USING_FAST_MALLOC(FontPlatformData); 72 USING_FAST_MALLOC(FontPlatformData);
73 public: 73 public:
74 // Used for deleted values in the font cache's hash tables. The hash table 74 // Used for deleted values in the font cache's hash tables. The hash table
75 // will create us with this structure, and it will compare other values 75 // will create us with this structure, and it will compare other values
76 // to this "Deleted" one. It expects the Deleted one to be differentiable 76 // to this "Deleted" one. It expects the Deleted one to be differentiable
77 // from the 0 one (created with the empty constructor), so we can't just 77 // from the 0 one (created with the empty constructor), so we can't just
78 // set everything to 0. 78 // set everything to 0.
79 FontPlatformData(WTF::HashTableDeletedValueType); 79 FontPlatformData(WTF::HashTableDeletedValueType);
80 FontPlatformData(); 80 FontPlatformData();
81 FontPlatformData(const FontPlatformData&); 81 FontPlatformData(const FontPlatformData&);
82 FontPlatformData(float size, bool syntheticBold, bool syntheticItalic, FontO rientation = FontOrientation::Horizontal); 82 FontPlatformData(bool syntheticBold, bool syntheticItalic, FontOrientation = FontOrientation::Horizontal);
83 FontPlatformData(const FontPlatformData& src, float textSize);
84 #if OS(MACOSX) 83 #if OS(MACOSX)
85 FontPlatformData(NSFont*, float size, bool syntheticBold = false, bool synth eticItalic = false, FontOrientation = FontOrientation::Horizontal); 84 FontPlatformData(NSFont*, float size, bool syntheticBold = false, bool synth eticItalic = false, FontOrientation = FontOrientation::Horizontal);
86 #endif 85 #endif
87 FontPlatformData(PassRefPtr<SkTypeface>, const char* name, float textSize, b ool syntheticBold, bool syntheticItalic, FontOrientation = FontOrientation::Hori zontal); 86 FontPlatformData(PassRefPtr<SkTypeface>, const char* name, bool syntheticBol d, bool syntheticItalic, FontOrientation = FontOrientation::Horizontal);
88 ~FontPlatformData(); 87 ~FontPlatformData();
89 88
90 #if OS(MACOSX) 89 #if OS(MACOSX)
91 CTFontRef ctFont() const; 90 CTFontRef ctFont() const;
92 CGFontRef cgFont() const; 91 CGFontRef cgFont() const;
93 #endif 92 #endif
94 93
95 String fontFamilyName() const; 94 String fontFamilyName() const;
96 float size() const { return m_textSize; }
97 bool syntheticBold() const { return m_syntheticBold; } 95 bool syntheticBold() const { return m_syntheticBold; }
98 bool syntheticItalic() const { return m_syntheticItalic; } 96 bool syntheticItalic() const { return m_syntheticItalic; }
99 97
100 SkTypeface* typeface() const; 98 SkTypeface* typeface() const;
101 HarfBuzzFace* harfBuzzFace() const; 99 HarfBuzzFace* harfBuzzFace() const;
102 bool hasSpaceInLigaturesOrKerning(TypesettingFeatures) const; 100 bool hasSpaceInLigaturesOrKerning(float fontSize, const FontRenderStyle&, Ty pesettingFeatures) const;
103 SkFontID uniqueID() const; 101 SkFontID uniqueID() const;
104 unsigned hash() const; 102 unsigned hash() const;
105 103
106 FontOrientation orientation() const { return m_orientation; } 104 FontOrientation orientation() const { return m_orientation; }
107 bool isVerticalAnyUpright() const { return blink::isVerticalAnyUpright(m_ori entation); } 105 bool isVerticalAnyUpright() const { return blink::isVerticalAnyUpright(m_ori entation); }
108 void setOrientation(FontOrientation orientation) { m_orientation = orientati on; } 106 void setOrientation(FontOrientation orientation) { m_orientation = orientati on; }
109 void setSyntheticBold(bool syntheticBold) { m_syntheticBold = syntheticBold; } 107 void setSyntheticBold(bool syntheticBold) { m_syntheticBold = syntheticBold; }
110 void setSyntheticItalic(bool syntheticItalic) { m_syntheticItalic = syntheti cItalic; } 108 void setSyntheticItalic(bool syntheticItalic) { m_syntheticItalic = syntheti cItalic; }
111 bool operator==(const FontPlatformData&) const; 109 bool operator==(const FontPlatformData&) const;
112 const FontPlatformData& operator=(const FontPlatformData&); 110 const FontPlatformData& operator=(const FontPlatformData&);
(...skipping 12 matching lines...) Expand all
125 #endif 123 #endif
126 bool fontContainsCharacter(UChar32 character); 124 bool fontContainsCharacter(UChar32 character);
127 125
128 PassRefPtr<OpenTypeVerticalData> verticalData() const; 126 PassRefPtr<OpenTypeVerticalData> verticalData() const;
129 PassRefPtr<SharedBuffer> openTypeTable(SkFontTableTag) const; 127 PassRefPtr<SharedBuffer> openTypeTable(SkFontTableTag) const;
130 128
131 #if !OS(MACOSX) 129 #if !OS(MACOSX)
132 // The returned styles are all actual styles without FontRenderStyle::NoPref erence. 130 // The returned styles are all actual styles without FontRenderStyle::NoPref erence.
133 const FontRenderStyle& getFontRenderStyle() const { return m_style; } 131 const FontRenderStyle& getFontRenderStyle() const { return m_style; }
134 #endif 132 #endif
135 void setupPaint(SkPaint*, float deviceScaleFactor = 1, const Font* = 0) cons t; 133 void setupPaint(SkPaint*) const;
136 134
137 #if OS(WIN) 135 #if OS(WIN)
138 int paintTextFlags() const { return m_paintTextFlags; } 136 int paintTextFlags() const { return m_paintTextFlags; }
139 #else
140 static void setHinting(SkPaint::Hinting);
141 static void setAutoHint(bool);
142 static void setUseBitmaps(bool);
143 static void setAntiAlias(bool);
144 static void setSubpixelRendering(bool);
145 #endif 137 #endif
146 138
147 private: 139 private:
148 #if !OS(MACOSX)
149 void querySystemForRenderStyle();
150 #endif
151
152 RefPtr<SkTypeface> m_typeface; 140 RefPtr<SkTypeface> m_typeface;
153 #if !OS(WIN) 141 #if !OS(WIN)
154 CString m_family; 142 CString m_family;
155 #endif 143 #endif
156 144
157 public: 145 public:
158 float m_textSize;
159 bool m_syntheticBold; 146 bool m_syntheticBold;
160 bool m_syntheticItalic; 147 bool m_syntheticItalic;
161 FontOrientation m_orientation; 148 FontOrientation m_orientation;
162 private: 149 private:
163 #if !OS(MACOSX) 150 #if !OS(MACOSX)
164 FontRenderStyle m_style; 151 FontRenderStyle m_style;
165 #endif 152 #endif
166 153
167 mutable RefPtr<HarfBuzzFace> m_harfBuzzFace; 154 mutable RefPtr<HarfBuzzFace> m_harfBuzzFace;
168 bool m_isHashTableDeletedValue; 155 bool m_isHashTableDeletedValue;
169 #if OS(WIN) 156 #if OS(WIN)
170 int m_paintTextFlags; 157 int m_paintTextFlags;
171 unsigned m_minSizeForAntiAlias; 158 unsigned m_minSizeForAntiAlias;
172 float m_minSizeForSubpixel; 159 float m_minSizeForSubpixel;
173 #endif 160 #endif
174 }; 161 };
175 162
176 } // namespace blink 163 } // namespace blink
177 164
178 #endif // ifdef FontPlatformData_h 165 #endif // ifdef FontPlatformData_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698