| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2008, 2010 Apple Inc. | 2 * Copyright (C) 2006, 2007, 2008, 2010 Apple Inc. |
| 3 * Copyright (C) 2006 Michael Emmel mike.emmel@gmail.com | 3 * Copyright (C) 2006 Michael Emmel mike.emmel@gmail.com |
| 4 * Copyright (C) 2007 Holger Hans Peter Freyther | 4 * Copyright (C) 2007 Holger Hans Peter Freyther |
| 5 * Copyright (C) 2007 Pioneer Research Center USA, Inc. | 5 * Copyright (C) 2007 Pioneer Research Center USA, Inc. |
| 6 * Copyright (C) 2010, 2011 Brent Fulgham <bfulgham@webkit.org> | 6 * Copyright (C) 2010, 2011 Brent Fulgham <bfulgham@webkit.org> |
| 7 * | 7 * |
| 8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
| 9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
| 10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 | 80 |
| 81 class PLATFORM_EXPORT FontPlatformData { | 81 class PLATFORM_EXPORT FontPlatformData { |
| 82 public: | 82 public: |
| 83 FontPlatformData(WTF::HashTableDeletedValueType); | 83 FontPlatformData(WTF::HashTableDeletedValueType); |
| 84 FontPlatformData(); | 84 FontPlatformData(); |
| 85 FontPlatformData(const FontPlatformData&); | 85 FontPlatformData(const FontPlatformData&); |
| 86 FontPlatformData(const FontDescription&, const AtomicString& family); | 86 FontPlatformData(const FontDescription&, const AtomicString& family); |
| 87 FontPlatformData(float size, bool syntheticBold, bool syntheticOblique, Font
Orientation = Horizontal, FontWidthVariant = RegularWidth); | 87 FontPlatformData(float size, bool syntheticBold, bool syntheticOblique, Font
Orientation = Horizontal, FontWidthVariant = RegularWidth); |
| 88 | 88 |
| 89 #if OS(MACOSX) | 89 #if OS(MACOSX) |
| 90 FontPlatformData(NSFont*, float size, bool isPrinterFont = false, bool synth
eticBold = false, bool syntheticOblique = false, | 90 FontPlatformData(NSFont*, float size, bool syntheticBold = false, bool synth
eticOblique = false, |
| 91 FontOrientation = Horizontal, FontWidthVariant = RegularWid
th); | 91 FontOrientation = Horizontal, FontWidthVariant = RegularWid
th); |
| 92 FontPlatformData(CGFontRef, float size, bool syntheticBold, bool syntheticOb
lique, FontOrientation, FontWidthVariant); | 92 FontPlatformData(CGFontRef, float size, bool syntheticBold, bool syntheticOb
lique, FontOrientation, FontWidthVariant); |
| 93 #endif | 93 #endif |
| 94 | 94 |
| 95 ~FontPlatformData(); | 95 ~FontPlatformData(); |
| 96 | 96 |
| 97 #if OS(MACOSX) | 97 #if OS(MACOSX) |
| 98 NSFont* font() const { return m_font; } | 98 NSFont* font() const { return m_font; } |
| 99 void setFont(NSFont*); | 99 void setFont(NSFont*); |
| 100 #endif | 100 #endif |
| 101 | 101 |
| 102 #if OS(MACOSX) | 102 #if OS(MACOSX) |
| 103 CGFontRef cgFont() const { return m_cgFont.get(); } | 103 CGFontRef cgFont() const { return m_cgFont.get(); } |
| 104 CTFontRef ctFont() const; | 104 CTFontRef ctFont() const; |
| 105 SkTypeface* typeface() const; | 105 SkTypeface* typeface() const; |
| 106 | 106 |
| 107 bool roundsGlyphAdvances() const; | 107 bool roundsGlyphAdvances() const; |
| 108 bool allowsLigatures() const; | 108 bool allowsLigatures() const; |
| 109 #endif | 109 #endif |
| 110 | 110 |
| 111 String fontFamilyName() const; | 111 String fontFamilyName() const; |
| 112 bool isFixedPitch() const; | 112 bool isFixedPitch() const; |
| 113 float size() const { return m_size; } | 113 float size() const { return m_size; } |
| 114 void setSize(float size) { m_size = size; } | 114 void setSize(float size) { m_size = size; } |
| 115 bool syntheticBold() const { return m_syntheticBold; } | 115 bool syntheticBold() const { return m_syntheticBold; } |
| 116 bool syntheticOblique() const { return m_syntheticOblique; } | 116 bool syntheticOblique() const { return m_syntheticOblique; } |
| 117 bool isColorBitmapFont() const { return m_isColorBitmapFont; } | 117 bool isColorBitmapFont() const { return m_isColorBitmapFont; } |
| 118 bool isCompositeFontReference() const { return m_isCompositeFontReference; } | 118 bool isCompositeFontReference() const { return m_isCompositeFontReference; } |
| 119 #if OS(MACOSX) | 119 |
| 120 bool isPrinterFont() const { return m_isPrinterFont; } | |
| 121 #endif | |
| 122 FontOrientation orientation() const { return m_orientation; } | 120 FontOrientation orientation() const { return m_orientation; } |
| 123 FontWidthVariant widthVariant() const { return m_widthVariant; } | 121 FontWidthVariant widthVariant() const { return m_widthVariant; } |
| 124 | 122 |
| 125 void setOrientation(FontOrientation orientation) { m_orientation = orientati
on; } | 123 void setOrientation(FontOrientation orientation) { m_orientation = orientati
on; } |
| 126 | 124 |
| 127 #if OS(MACOSX) | 125 #if OS(MACOSX) |
| 128 HarfBuzzFace* harfBuzzFace(); | 126 HarfBuzzFace* harfBuzzFace(); |
| 129 #endif | 127 #endif |
| 130 | 128 |
| 131 unsigned hash() const | 129 unsigned hash() const |
| 132 { | 130 { |
| 133 #if OS(MACOSX) | 131 #if OS(MACOSX) |
| 134 ASSERT(m_font || !m_cgFont); | 132 ASSERT(m_font || !m_cgFont); |
| 135 uintptr_t hashCodes[3] = { (uintptr_t)m_font, m_widthVariant, static_cas
t<uintptr_t>(m_isPrinterFont << 3 | m_orientation << 2 | m_syntheticBold << 1 |
m_syntheticOblique) }; | 133 uintptr_t hashCodes[3] = { (uintptr_t)m_font, m_widthVariant, static_cas
t<uintptr_t>(m_orientation << 2 | m_syntheticBold << 1 | m_syntheticOblique) }; |
| 136 return StringHasher::hashMemory<sizeof(hashCodes)>(hashCodes); | 134 return StringHasher::hashMemory<sizeof(hashCodes)>(hashCodes); |
| 137 #endif | 135 #endif |
| 138 } | 136 } |
| 139 | 137 |
| 140 const FontPlatformData& operator=(const FontPlatformData&); | 138 const FontPlatformData& operator=(const FontPlatformData&); |
| 141 | 139 |
| 142 bool operator==(const FontPlatformData& other) const | 140 bool operator==(const FontPlatformData& other) const |
| 143 { | 141 { |
| 144 return platformIsEqual(other) | 142 return platformIsEqual(other) |
| 145 && m_size == other.m_size | 143 && m_size == other.m_size |
| 146 && m_syntheticBold == other.m_syntheticBold | 144 && m_syntheticBold == other.m_syntheticBold |
| 147 && m_syntheticOblique == other.m_syntheticOblique | 145 && m_syntheticOblique == other.m_syntheticOblique |
| 148 && m_isColorBitmapFont == other.m_isColorBitmapFont | 146 && m_isColorBitmapFont == other.m_isColorBitmapFont |
| 149 && m_isCompositeFontReference == other.m_isCompositeFontReference | 147 && m_isCompositeFontReference == other.m_isCompositeFontReference |
| 150 #if OS(MACOSX) | |
| 151 && m_isPrinterFont == other.m_isPrinterFont | |
| 152 #endif | |
| 153 && m_orientation == other.m_orientation | 148 && m_orientation == other.m_orientation |
| 154 && m_widthVariant == other.m_widthVariant; | 149 && m_widthVariant == other.m_widthVariant; |
| 155 } | 150 } |
| 156 | 151 |
| 157 bool isHashTableDeletedValue() const | 152 bool isHashTableDeletedValue() const |
| 158 { | 153 { |
| 159 #if OS(MACOSX) | 154 #if OS(MACOSX) |
| 160 return m_font == hashTableDeletedFontValue(); | 155 return m_font == hashTableDeletedFontValue(); |
| 161 #endif | 156 #endif |
| 162 } | 157 } |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 RetainPtr<CGFontRef> m_cgFont; | 191 RetainPtr<CGFontRef> m_cgFont; |
| 197 mutable RetainPtr<CTFontRef> m_CTFont; | 192 mutable RetainPtr<CTFontRef> m_CTFont; |
| 198 | 193 |
| 199 RefPtr<MemoryActivatedFont> m_inMemoryFont; | 194 RefPtr<MemoryActivatedFont> m_inMemoryFont; |
| 200 RefPtr<HarfBuzzFace> m_harfBuzzFace; | 195 RefPtr<HarfBuzzFace> m_harfBuzzFace; |
| 201 mutable RefPtr<SkTypeface> m_typeface; | 196 mutable RefPtr<SkTypeface> m_typeface; |
| 202 #endif | 197 #endif |
| 203 | 198 |
| 204 bool m_isColorBitmapFont; | 199 bool m_isColorBitmapFont; |
| 205 bool m_isCompositeFontReference; | 200 bool m_isCompositeFontReference; |
| 206 #if OS(MACOSX) | |
| 207 bool m_isPrinterFont; | |
| 208 #endif | |
| 209 }; | 201 }; |
| 210 | 202 |
| 211 } // namespace WebCore | 203 } // namespace WebCore |
| 212 | 204 |
| 213 #endif // FontPlatformData_h | 205 #endif // FontPlatformData_h |
| 214 | 206 |
| 215 #endif | 207 #endif |
| OLD | NEW |