Chromium Code Reviews| 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 | |
|
Daniel Erat
2014/09/09 21:17:12
nit: one blank line instead of two? feel free to i
| |
| 123 bool isHashTableDeletedValue() const { return m_isHashTableDeletedValue; } | 124 bool isHashTableDeletedValue() const { return m_isHashTableDeletedValue; } |
| 124 #if OS(WIN) | 125 #if OS(WIN) |
| 125 void setMinSizeForAntiAlias(unsigned size) { m_minSizeForAntiAlias = size; } | 126 void setMinSizeForAntiAlias(unsigned size) { m_minSizeForAntiAlias = size; } |
| 126 unsigned minSizeForAntiAlias() const { return m_minSizeForAntiAlias; } | 127 unsigned minSizeForAntiAlias() const { return m_minSizeForAntiAlias; } |
| 127 void setMinSizeForSubpixel(float size) { m_minSizeForSubpixel = size; } | 128 void setMinSizeForSubpixel(float size) { m_minSizeForSubpixel = size; } |
| 128 float minSizeForSubpixel() const { return m_minSizeForSubpixel; } | 129 float minSizeForSubpixel() const { return m_minSizeForSubpixel; } |
| 129 void setHinting(SkPaint::Hinting style) | 130 void setHinting(SkPaint::Hinting style) |
| 130 { | 131 { |
| 131 m_style.useAutoHint = 0; | 132 m_style.useAutoHint = 0; |
| 132 m_style.hintStyle = style; | 133 m_style.hintStyle = style; |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 160 bool static defaultUseSubpixelPositioning(); | 161 bool static defaultUseSubpixelPositioning(); |
| 161 void querySystemForRenderStyle(bool useSkiaSubpixelPositioning); | 162 void querySystemForRenderStyle(bool useSkiaSubpixelPositioning); |
| 162 #else | 163 #else |
| 163 // Load various data about the font specified by |nsFont| with the size font Size into the following output paramters: | 164 // 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 | 165 // 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. | 166 // 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. | 167 // * 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. | 168 // 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. | 169 // * cgFont - CGFontRef representing the input font at the specified point s ize. |
| 169 void loadFont(NSFont*, float fontSize, NSFont*& outNSFont, CGFontRef&); | 170 void loadFont(NSFont*, float fontSize, NSFont*& outNSFont, CGFontRef&); |
| 170 | |
| 171 bool platformIsEqual(const FontPlatformData&) const; | |
| 172 void platformDataInit(const FontPlatformData&); | 171 void platformDataInit(const FontPlatformData&); |
| 173 const FontPlatformData& platformDataAssign(const FontPlatformData&); | 172 const FontPlatformData& platformDataAssign(const FontPlatformData&); |
| 173 bool isAATFont(CTFontRef) const; | |
| 174 #endif | 174 #endif |
| 175 | 175 |
| 176 mutable RefPtr<SkTypeface> m_typeface; | 176 mutable RefPtr<SkTypeface> m_typeface; |
| 177 #if !OS(WIN) | 177 #if !OS(WIN) |
| 178 CString m_family; | 178 CString m_family; |
| 179 #endif | 179 #endif |
| 180 | 180 |
| 181 public: | 181 public: |
| 182 float m_textSize; | 182 float m_textSize; |
| 183 bool m_syntheticBold; | 183 bool m_syntheticBold; |
| 184 bool m_syntheticItalic; | 184 bool m_syntheticItalic; |
| 185 FontOrientation m_orientation; | 185 FontOrientation m_orientation; |
| 186 #if OS(MACOSX) | 186 #if OS(MACOSX) |
| 187 bool m_isColorBitmapFont; | 187 bool m_isColorBitmapFont; |
| 188 bool m_isCompositeFontReference; | 188 bool m_isCompositeFontReference; |
| 189 #endif | |
| 189 FontWidthVariant m_widthVariant; | 190 FontWidthVariant m_widthVariant; |
| 190 #endif | |
| 191 private: | 191 private: |
| 192 #if OS(MACOSX) | 192 #if OS(MACOSX) |
| 193 NSFont* m_font; | 193 NSFont* m_font; |
| 194 RetainPtr<CGFontRef> m_cgFont; | 194 RetainPtr<CGFontRef> m_cgFont; |
| 195 mutable RetainPtr<CTFontRef> m_CTFont; | 195 mutable RetainPtr<CTFontRef> m_CTFont; |
| 196 RefPtr<MemoryActivatedFont> m_inMemoryFont; | 196 RefPtr<MemoryActivatedFont> m_inMemoryFont; |
| 197 #else | 197 #else |
| 198 FontRenderStyle m_style; | 198 FontRenderStyle m_style; |
| 199 #endif | 199 #endif |
| 200 | 200 |
| 201 mutable RefPtr<HarfBuzzFace> m_harfBuzzFace; | 201 mutable RefPtr<HarfBuzzFace> m_harfBuzzFace; |
| 202 bool m_isHashTableDeletedValue; | 202 bool m_isHashTableDeletedValue; |
| 203 #if OS(WIN) | 203 #if OS(WIN) |
| 204 int m_paintTextFlags; | 204 int m_paintTextFlags; |
| 205 bool m_useSubpixelPositioning; | 205 bool m_useSubpixelPositioning; |
| 206 unsigned m_minSizeForAntiAlias; | 206 unsigned m_minSizeForAntiAlias; |
| 207 float m_minSizeForSubpixel; | 207 float m_minSizeForSubpixel; |
| 208 #endif | 208 #endif |
| 209 }; | 209 }; |
| 210 | 210 |
| 211 } // namespace blink | 211 } // namespace blink |
| 212 | 212 |
| 213 #endif // ifdef FontPlatformData_h | 213 #endif // ifdef FontPlatformData_h |
| OLD | NEW |