OLD | NEW |
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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 class PLATFORM_EXPORT FontPlatformData { | 68 class PLATFORM_EXPORT FontPlatformData { |
69 public: | 69 public: |
70 // Used for deleted values in the font cache's hash tables. The hash table | 70 // Used for deleted values in the font cache's hash tables. The hash table |
71 // will create us with this structure, and it will compare other values | 71 // will create us with this structure, and it will compare other values |
72 // to this "Deleted" one. It expects the Deleted one to be differentiable | 72 // to this "Deleted" one. It expects the Deleted one to be differentiable |
73 // from the 0 one (created with the empty constructor), so we can't just | 73 // from the 0 one (created with the empty constructor), so we can't just |
74 // set everything to 0. | 74 // set everything to 0. |
75 FontPlatformData(WTF::HashTableDeletedValueType); | 75 FontPlatformData(WTF::HashTableDeletedValueType); |
76 FontPlatformData(); | 76 FontPlatformData(); |
77 FontPlatformData(const FontPlatformData&); | 77 FontPlatformData(const FontPlatformData&); |
| 78 FontPlatformData(float size, bool syntheticBold, bool syntheticItalic, FontO
rientation = Horizontal, FontWidthVariant = RegularWidth); |
78 #if OS(MACOSX) | 79 #if OS(MACOSX) |
79 FontPlatformData(float size, bool syntheticBold, bool syntheticItalic, FontO
rientation = Horizontal, FontWidthVariant = RegularWidth); | |
80 FontPlatformData(NSFont*, float size, bool syntheticBold = false, bool synth
eticItalic = false, | 80 FontPlatformData(NSFont*, float size, bool syntheticBold = false, bool synth
eticItalic = false, |
81 FontOrientation = Horizontal, FontWidthVariant = RegularWid
th); | 81 FontOrientation = Horizontal, FontWidthVariant = RegularWid
th); |
82 FontPlatformData(CGFontRef, float size, bool syntheticBold, bool syntheticOb
lique, FontOrientation, FontWidthVariant); | 82 FontPlatformData(CGFontRef, float size, bool syntheticBold, bool syntheticOb
lique, FontOrientation, FontWidthVariant); |
83 #else | 83 #else |
84 FontPlatformData(float textSize, bool syntheticBold, bool syntheticItalic); | |
85 FontPlatformData(PassRefPtr<SkTypeface>, const char* name, float textSize, b
ool syntheticBold, bool syntheticItalic, FontOrientation = Horizontal, bool subp
ixelTextPosition = defaultUseSubpixelPositioning()); | 84 FontPlatformData(PassRefPtr<SkTypeface>, const char* name, float textSize, b
ool syntheticBold, bool syntheticItalic, FontOrientation = Horizontal, bool subp
ixelTextPosition = defaultUseSubpixelPositioning()); |
86 FontPlatformData(const FontPlatformData& src, float textSize); | 85 FontPlatformData(const FontPlatformData& src, float textSize); |
87 #endif | 86 #endif |
88 ~FontPlatformData(); | 87 ~FontPlatformData(); |
89 | 88 |
90 #if OS(MACOSX) | 89 #if OS(MACOSX) |
91 NSFont* font() const { return m_font; } | 90 NSFont* font() const { return m_font; } |
92 void setFont(NSFont*); | 91 void setFont(NSFont*); |
93 | 92 |
94 CGFontRef cgFont() const { return m_cgFont.get(); } | 93 CGFontRef cgFont() const { return m_cgFont.get(); } |
(...skipping 18 matching lines...) Expand all Loading... |
113 HarfBuzzFace* harfBuzzFace() const; | 112 HarfBuzzFace* harfBuzzFace() const; |
114 SkFontID uniqueID() const; | 113 SkFontID uniqueID() const; |
115 unsigned hash() const; | 114 unsigned hash() const; |
116 | 115 |
117 FontOrientation orientation() const { return m_orientation; } | 116 FontOrientation orientation() const { return m_orientation; } |
118 void setOrientation(FontOrientation orientation) { m_orientation = orientati
on; } | 117 void setOrientation(FontOrientation orientation) { m_orientation = orientati
on; } |
119 void setSyntheticBold(bool syntheticBold) { m_syntheticBold = syntheticBold;
} | 118 void setSyntheticBold(bool syntheticBold) { m_syntheticBold = syntheticBold;
} |
120 void setSyntheticItalic(bool syntheticItalic) { m_syntheticItalic = syntheti
cItalic; } | 119 void setSyntheticItalic(bool syntheticItalic) { m_syntheticItalic = syntheti
cItalic; } |
121 bool operator==(const FontPlatformData&) const; | 120 bool operator==(const FontPlatformData&) const; |
122 const FontPlatformData& operator=(const FontPlatformData&); | 121 const FontPlatformData& operator=(const FontPlatformData&); |
| 122 |
123 bool isHashTableDeletedValue() const { return m_isHashTableDeletedValue; } | 123 bool isHashTableDeletedValue() const { return m_isHashTableDeletedValue; } |
124 #if OS(WIN) | 124 #if OS(WIN) |
125 void setMinSizeForAntiAlias(unsigned size) { m_minSizeForAntiAlias = size; } | 125 void setMinSizeForAntiAlias(unsigned size) { m_minSizeForAntiAlias = size; } |
126 unsigned minSizeForAntiAlias() const { return m_minSizeForAntiAlias; } | 126 unsigned minSizeForAntiAlias() const { return m_minSizeForAntiAlias; } |
127 void setMinSizeForSubpixel(float size) { m_minSizeForSubpixel = size; } | 127 void setMinSizeForSubpixel(float size) { m_minSizeForSubpixel = size; } |
128 float minSizeForSubpixel() const { return m_minSizeForSubpixel; } | 128 float minSizeForSubpixel() const { return m_minSizeForSubpixel; } |
129 void setHinting(SkPaint::Hinting style) | 129 void setHinting(SkPaint::Hinting style) |
130 { | 130 { |
131 m_style.useAutoHint = 0; | 131 m_style.useAutoHint = 0; |
132 m_style.hintStyle = style; | 132 m_style.hintStyle = style; |
(...skipping 27 matching lines...) Expand all Loading... |
160 bool static defaultUseSubpixelPositioning(); | 160 bool static defaultUseSubpixelPositioning(); |
161 void querySystemForRenderStyle(bool useSkiaSubpixelPositioning); | 161 void querySystemForRenderStyle(bool useSkiaSubpixelPositioning); |
162 #else | 162 #else |
163 // Load various data about the font specified by |nsFont| with the size font
Size into the following output paramters: | 163 // Load various data about the font specified by |nsFont| with the size font
Size into the following output paramters: |
164 // Note: Callers should always take into account that for the Chromium port,
|outNSFont| isn't necessarily the same | 164 // Note: Callers should always take into account that for the Chromium port,
|outNSFont| isn't necessarily the same |
165 // font as |nsFont|. This because the sandbox may block loading of the origi
nal font. | 165 // font as |nsFont|. This because the sandbox may block loading of the origi
nal font. |
166 // * outNSFont - The font that was actually loaded, for the Chromium port th
is may be different than nsFont. | 166 // * outNSFont - The font that was actually loaded, for the Chromium port th
is may be different than nsFont. |
167 // The caller is responsible for calling CFRelease() on this parameter when
done with it. | 167 // The caller is responsible for calling CFRelease() on this parameter when
done with it. |
168 // * cgFont - CGFontRef representing the input font at the specified point s
ize. | 168 // * cgFont - CGFontRef representing the input font at the specified point s
ize. |
169 void loadFont(NSFont*, float fontSize, NSFont*& outNSFont, CGFontRef&); | 169 void loadFont(NSFont*, float fontSize, NSFont*& outNSFont, CGFontRef&); |
170 | |
171 bool platformIsEqual(const FontPlatformData&) const; | |
172 void platformDataInit(const FontPlatformData&); | 170 void platformDataInit(const FontPlatformData&); |
173 const FontPlatformData& platformDataAssign(const FontPlatformData&); | 171 const FontPlatformData& platformDataAssign(const FontPlatformData&); |
| 172 bool isAATFont(CTFontRef) const; |
174 #endif | 173 #endif |
175 | 174 |
176 mutable RefPtr<SkTypeface> m_typeface; | 175 mutable RefPtr<SkTypeface> m_typeface; |
177 #if !OS(WIN) | 176 #if !OS(WIN) |
178 CString m_family; | 177 CString m_family; |
179 #endif | 178 #endif |
180 | 179 |
181 public: | 180 public: |
182 float m_textSize; | 181 float m_textSize; |
183 bool m_syntheticBold; | 182 bool m_syntheticBold; |
184 bool m_syntheticItalic; | 183 bool m_syntheticItalic; |
185 FontOrientation m_orientation; | 184 FontOrientation m_orientation; |
186 #if OS(MACOSX) | 185 #if OS(MACOSX) |
187 bool m_isColorBitmapFont; | 186 bool m_isColorBitmapFont; |
188 bool m_isCompositeFontReference; | 187 bool m_isCompositeFontReference; |
| 188 #endif |
189 FontWidthVariant m_widthVariant; | 189 FontWidthVariant m_widthVariant; |
190 #endif | |
191 private: | 190 private: |
192 #if OS(MACOSX) | 191 #if OS(MACOSX) |
193 NSFont* m_font; | 192 NSFont* m_font; |
194 RetainPtr<CGFontRef> m_cgFont; | 193 RetainPtr<CGFontRef> m_cgFont; |
195 mutable RetainPtr<CTFontRef> m_CTFont; | 194 mutable RetainPtr<CTFontRef> m_CTFont; |
196 RefPtr<MemoryActivatedFont> m_inMemoryFont; | 195 RefPtr<MemoryActivatedFont> m_inMemoryFont; |
197 #else | 196 #else |
198 FontRenderStyle m_style; | 197 FontRenderStyle m_style; |
199 #endif | 198 #endif |
200 | 199 |
201 mutable RefPtr<HarfBuzzFace> m_harfBuzzFace; | 200 mutable RefPtr<HarfBuzzFace> m_harfBuzzFace; |
202 bool m_isHashTableDeletedValue; | 201 bool m_isHashTableDeletedValue; |
203 #if OS(WIN) | 202 #if OS(WIN) |
204 int m_paintTextFlags; | 203 int m_paintTextFlags; |
205 bool m_useSubpixelPositioning; | 204 bool m_useSubpixelPositioning; |
206 unsigned m_minSizeForAntiAlias; | 205 unsigned m_minSizeForAntiAlias; |
207 float m_minSizeForSubpixel; | 206 float m_minSizeForSubpixel; |
208 #endif | 207 #endif |
209 }; | 208 }; |
210 | 209 |
211 } // namespace blink | 210 } // namespace blink |
212 | 211 |
213 #endif // ifdef FontPlatformData_h | 212 #endif // ifdef FontPlatformData_h |
OLD | NEW |