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 #if OS(MACOSX) |
78 FontPlatformData(float size, bool syntheticBold, bool syntheticItalic, FontO
rientation = Horizontal, FontWidthVariant = RegularWidth); | 79 FontPlatformData(float size, bool syntheticBold, bool syntheticItalic, FontO
rientation = Horizontal, FontWidthVariant = RegularWidth); |
79 #if OS(MACOSX) | |
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); |
84 FontPlatformData(PassRefPtr<SkTypeface>, const char* name, float textSize, b
ool syntheticBold, bool syntheticItalic, FontOrientation = Horizontal, bool subp
ixelTextPosition = defaultUseSubpixelPositioning()); | 85 FontPlatformData(PassRefPtr<SkTypeface>, const char* name, float textSize, b
ool syntheticBold, bool syntheticItalic, FontOrientation = Horizontal, bool subp
ixelTextPosition = defaultUseSubpixelPositioning()); |
85 FontPlatformData(const FontPlatformData& src, float textSize); | 86 FontPlatformData(const FontPlatformData& src, float textSize); |
86 #endif | 87 #endif |
87 ~FontPlatformData(); | 88 ~FontPlatformData(); |
88 | 89 |
89 #if OS(MACOSX) | 90 #if OS(MACOSX) |
90 NSFont* font() const { return m_font; } | 91 NSFont* font() const { return m_font; } |
91 void setFont(NSFont*); | 92 void setFont(NSFont*); |
92 | 93 |
93 CGFontRef cgFont() const { return m_cgFont.get(); } | 94 CGFontRef cgFont() const { return m_cgFont.get(); } |
(...skipping 18 matching lines...) Expand all Loading... |
112 HarfBuzzFace* harfBuzzFace() const; | 113 HarfBuzzFace* harfBuzzFace() const; |
113 SkFontID uniqueID() const; | 114 SkFontID uniqueID() const; |
114 unsigned hash() const; | 115 unsigned hash() const; |
115 | 116 |
116 FontOrientation orientation() const { return m_orientation; } | 117 FontOrientation orientation() const { return m_orientation; } |
117 void setOrientation(FontOrientation orientation) { m_orientation = orientati
on; } | 118 void setOrientation(FontOrientation orientation) { m_orientation = orientati
on; } |
118 void setSyntheticBold(bool syntheticBold) { m_syntheticBold = syntheticBold;
} | 119 void setSyntheticBold(bool syntheticBold) { m_syntheticBold = syntheticBold;
} |
119 void setSyntheticItalic(bool syntheticItalic) { m_syntheticItalic = syntheti
cItalic; } | 120 void setSyntheticItalic(bool syntheticItalic) { m_syntheticItalic = syntheti
cItalic; } |
120 bool operator==(const FontPlatformData&) const; | 121 bool operator==(const FontPlatformData&) const; |
121 const FontPlatformData& operator=(const FontPlatformData&); | 122 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; |
170 void platformDataInit(const FontPlatformData&); | 172 void platformDataInit(const FontPlatformData&); |
171 const FontPlatformData& platformDataAssign(const FontPlatformData&); | 173 const FontPlatformData& platformDataAssign(const FontPlatformData&); |
172 bool isAATFont(CTFontRef) const; | |
173 #endif | 174 #endif |
174 | 175 |
175 mutable RefPtr<SkTypeface> m_typeface; | 176 mutable RefPtr<SkTypeface> m_typeface; |
176 #if !OS(WIN) | 177 #if !OS(WIN) |
177 CString m_family; | 178 CString m_family; |
178 #endif | 179 #endif |
179 | 180 |
180 public: | 181 public: |
181 float m_textSize; | 182 float m_textSize; |
182 bool m_syntheticBold; | 183 bool m_syntheticBold; |
183 bool m_syntheticItalic; | 184 bool m_syntheticItalic; |
184 FontOrientation m_orientation; | 185 FontOrientation m_orientation; |
185 #if OS(MACOSX) | 186 #if OS(MACOSX) |
186 bool m_isColorBitmapFont; | 187 bool m_isColorBitmapFont; |
187 bool m_isCompositeFontReference; | 188 bool m_isCompositeFontReference; |
| 189 FontWidthVariant m_widthVariant; |
188 #endif | 190 #endif |
189 FontWidthVariant m_widthVariant; | |
190 private: | 191 private: |
191 #if OS(MACOSX) | 192 #if OS(MACOSX) |
192 NSFont* m_font; | 193 NSFont* m_font; |
193 RetainPtr<CGFontRef> m_cgFont; | 194 RetainPtr<CGFontRef> m_cgFont; |
194 mutable RetainPtr<CTFontRef> m_CTFont; | 195 mutable RetainPtr<CTFontRef> m_CTFont; |
195 RefPtr<MemoryActivatedFont> m_inMemoryFont; | 196 RefPtr<MemoryActivatedFont> m_inMemoryFont; |
196 #else | 197 #else |
197 FontRenderStyle m_style; | 198 FontRenderStyle m_style; |
198 #endif | 199 #endif |
199 | 200 |
200 mutable RefPtr<HarfBuzzFace> m_harfBuzzFace; | 201 mutable RefPtr<HarfBuzzFace> m_harfBuzzFace; |
201 bool m_isHashTableDeletedValue; | 202 bool m_isHashTableDeletedValue; |
202 #if OS(WIN) | 203 #if OS(WIN) |
203 int m_paintTextFlags; | 204 int m_paintTextFlags; |
204 bool m_useSubpixelPositioning; | 205 bool m_useSubpixelPositioning; |
205 unsigned m_minSizeForAntiAlias; | 206 unsigned m_minSizeForAntiAlias; |
206 float m_minSizeForSubpixel; | 207 float m_minSizeForSubpixel; |
207 #endif | 208 #endif |
208 }; | 209 }; |
209 | 210 |
210 } // namespace blink | 211 } // namespace blink |
211 | 212 |
212 #endif // ifdef FontPlatformData_h | 213 #endif // ifdef FontPlatformData_h |
OLD | NEW |