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

Side by Side Diff: Source/WebCore/platform/graphics/FontPlatformData.h

Issue 13529026: Removing a bunch of unused platform code. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix whitespace and compiler error on Mac. Created 7 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « Source/WebCore/platform/graphics/Font.h ('k') | Source/WebCore/platform/graphics/GlyphBuffer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
11 * version 2 of the License, or (at your option) any later version. 11 * version 2 of the License, or (at your option) any later version.
12 * 12 *
13 * This library is distributed in the hope that it will be useful, 13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Library General Public License for more details. 16 * Library General Public License for more details.
17 * 17 *
18 * You should have received a copy of the GNU Library General Public License 18 * You should have received a copy of the GNU Library General Public License
19 * along with this library; see the file COPYING.LIB. If not, write to 19 * along with this library; see the file COPYING.LIB. If not, write to
20 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 20 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 * Boston, MA 02110-1301, USA. 21 * Boston, MA 02110-1301, USA.
22 * 22 *
23 */ 23 */
24 24
25 // FIXME: This is temporary until all ports switch to using this file. 25 // FIXME: This is temporary until all ports switch to using this file.
26 #if (PLATFORM(CHROMIUM) && !OS(DARWIN)) || PLATFORM(BLACKBERRY) 26 #if PLATFORM(CHROMIUM) && !OS(DARWIN)
27 #include "chromium/FontPlatformData.h" 27 #include "chromium/FontPlatformData.h"
28 #elif PLATFORM(QT)
29 #include "qt/FontPlatformData.h"
30 #elif PLATFORM(WIN) && OS(WINCE)
31 #include "wince/FontPlatformData.h"
32 #elif PLATFORM(GTK)
33 #include "freetype/FontPlatformData.h"
34 #else 28 #else
35 29
36 #ifndef FontPlatformData_h 30 #ifndef FontPlatformData_h
37 #define FontPlatformData_h 31 #define FontPlatformData_h
38 32
39 #include "FontOrientation.h" 33 #include "FontOrientation.h"
40 #include "FontWidthVariant.h" 34 #include "FontWidthVariant.h"
41 35
42 #if PLATFORM(WIN)
43 #include "RefCountedGDIHandle.h"
44 #endif
45
46 #if OS(DARWIN) 36 #if OS(DARWIN)
47 OBJC_CLASS NSFont; 37 OBJC_CLASS NSFont;
48 38
49 typedef struct CGFont* CGFontRef; 39 typedef struct CGFont* CGFontRef;
50 typedef const struct __CTFont* CTFontRef; 40 typedef const struct __CTFont* CTFontRef;
51 41
52 #include <CoreFoundation/CFBase.h> 42 #include <CoreFoundation/CFBase.h>
53 #include <objc/objc-auto.h> 43 #include <objc/objc-auto.h>
54 #endif 44 #endif
55 45
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 FontPlatformData(const FontDescription&, const AtomicString& family); 88 FontPlatformData(const FontDescription&, const AtomicString& family);
99 FontPlatformData(float size, bool syntheticBold, bool syntheticOblique, Font Orientation = Horizontal, FontWidthVariant = RegularWidth); 89 FontPlatformData(float size, bool syntheticBold, bool syntheticOblique, Font Orientation = Horizontal, FontWidthVariant = RegularWidth);
100 90
101 #if OS(DARWIN) 91 #if OS(DARWIN)
102 FontPlatformData(NSFont*, float size, bool isPrinterFont = false, bool synth eticBold = false, bool syntheticOblique = false, 92 FontPlatformData(NSFont*, float size, bool isPrinterFont = false, bool synth eticBold = false, bool syntheticOblique = false,
103 FontOrientation = Horizontal, FontWidthVariant = RegularWid th); 93 FontOrientation = Horizontal, FontWidthVariant = RegularWid th);
104 #if USE(CG) || USE(SKIA_ON_MAC_CHROMIUM) 94 #if USE(CG) || USE(SKIA_ON_MAC_CHROMIUM)
105 FontPlatformData(CGFontRef, float size, bool syntheticBold, bool syntheticOb lique, FontOrientation, FontWidthVariant); 95 FontPlatformData(CGFontRef, float size, bool syntheticBold, bool syntheticOb lique, FontOrientation, FontWidthVariant);
106 #endif 96 #endif
107 #endif 97 #endif
108 #if PLATFORM(WIN)
109 FontPlatformData(HFONT, float size, bool syntheticBold, bool syntheticObliqu e, bool useGDI);
110 #if USE(CG)
111 FontPlatformData(HFONT, CGFontRef, float size, bool syntheticBold, bool synt heticOblique, bool useGDI);
112 #endif
113 #endif
114 98
115 ~FontPlatformData(); 99 ~FontPlatformData();
116 100
117 #if PLATFORM(WIN) 101 #if OS(DARWIN)
118 HFONT hfont() const { return m_font ? m_font->handle() : 0; }
119 bool useGDI() const { return m_useGDI; }
120 #elif OS(DARWIN)
121 NSFont* font() const { return m_font; } 102 NSFont* font() const { return m_font; }
122 void setFont(NSFont*); 103 void setFont(NSFont*);
123 #endif 104 #endif
124 105
125 #if USE(CG) || USE(SKIA_ON_MAC_CHROMIUM) 106 #if USE(CG) || USE(SKIA_ON_MAC_CHROMIUM)
126 #if OS(DARWIN) 107 #if OS(DARWIN)
127 CGFontRef cgFont() const { return m_cgFont.get(); } 108 CGFontRef cgFont() const { return m_cgFont.get(); }
128 CTFontRef ctFont() const; 109 CTFontRef ctFont() const;
129 110
130 bool roundsGlyphAdvances() const; 111 bool roundsGlyphAdvances() const;
(...skipping 17 matching lines...) Expand all
148 FontWidthVariant widthVariant() const { return m_widthVariant; } 129 FontWidthVariant widthVariant() const { return m_widthVariant; }
149 130
150 void setOrientation(FontOrientation orientation) { m_orientation = orientati on; } 131 void setOrientation(FontOrientation orientation) { m_orientation = orientati on; }
151 132
152 #if PLATFORM(CHROMIUM) && OS(DARWIN) 133 #if PLATFORM(CHROMIUM) && OS(DARWIN)
153 HarfBuzzFace* harfBuzzFace(); 134 HarfBuzzFace* harfBuzzFace();
154 #endif 135 #endif
155 136
156 unsigned hash() const 137 unsigned hash() const
157 { 138 {
158 #if PLATFORM(WIN) 139 #if OS(DARWIN)
159 return m_font ? m_font->hash() : 0;
160 #elif OS(DARWIN)
161 #if USE(CG) || USE(SKIA_ON_MAC_CHROMIUM) 140 #if USE(CG) || USE(SKIA_ON_MAC_CHROMIUM)
162 ASSERT(m_font || !m_cgFont); 141 ASSERT(m_font || !m_cgFont);
163 #endif 142 #endif
164 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) }; 143 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) };
165 return StringHasher::hashMemory<sizeof(hashCodes)>(hashCodes); 144 return StringHasher::hashMemory<sizeof(hashCodes)>(hashCodes);
166 #endif 145 #endif
167 } 146 }
168 147
169 const FontPlatformData& operator=(const FontPlatformData&); 148 const FontPlatformData& operator=(const FontPlatformData&);
170 149
171 bool operator==(const FontPlatformData& other) const 150 bool operator==(const FontPlatformData& other) const
172 { 151 {
173 return platformIsEqual(other) 152 return platformIsEqual(other)
174 && m_size == other.m_size 153 && m_size == other.m_size
175 && m_syntheticBold == other.m_syntheticBold 154 && m_syntheticBold == other.m_syntheticBold
176 && m_syntheticOblique == other.m_syntheticOblique 155 && m_syntheticOblique == other.m_syntheticOblique
177 && m_isColorBitmapFont == other.m_isColorBitmapFont 156 && m_isColorBitmapFont == other.m_isColorBitmapFont
178 && m_isCompositeFontReference == other.m_isCompositeFontReference 157 && m_isCompositeFontReference == other.m_isCompositeFontReference
179 #if OS(DARWIN) 158 #if OS(DARWIN)
180 && m_isPrinterFont == other.m_isPrinterFont 159 && m_isPrinterFont == other.m_isPrinterFont
181 #endif 160 #endif
182 && m_orientation == other.m_orientation 161 && m_orientation == other.m_orientation
183 && m_widthVariant == other.m_widthVariant; 162 && m_widthVariant == other.m_widthVariant;
184 } 163 }
185 164
186 bool isHashTableDeletedValue() const 165 bool isHashTableDeletedValue() const
187 { 166 {
188 #if PLATFORM(WIN) 167 #if OS(DARWIN)
189 return m_font.isHashTableDeletedValue();
190 #elif OS(DARWIN)
191 return m_font == hashTableDeletedFontValue(); 168 return m_font == hashTableDeletedFontValue();
192 #endif 169 #endif
193 } 170 }
194 171
195 #if PLATFORM(WIN) && USE(CG)
196 PassRefPtr<SharedBuffer> openTypeTable(uint32_t table) const;
197 #endif
198
199 #ifndef NDEBUG 172 #ifndef NDEBUG
200 String description() const; 173 String description() const;
201 #endif 174 #endif
202 175
203 private: 176 private:
204 bool platformIsEqual(const FontPlatformData&) const; 177 bool platformIsEqual(const FontPlatformData&) const;
205 void platformDataInit(const FontPlatformData&); 178 void platformDataInit(const FontPlatformData&);
206 const FontPlatformData& platformDataAssign(const FontPlatformData&); 179 const FontPlatformData& platformDataAssign(const FontPlatformData&);
207 #if OS(DARWIN) 180 #if OS(DARWIN)
208 // Load various data about the font specified by |nsFont| with the size font Size into the following output paramters: 181 // Load various data about the font specified by |nsFont| with the size font Size into the following output paramters:
209 // Note: Callers should always take into account that for the Chromium port, |outNSFont| isn't necessarily the same 182 // Note: Callers should always take into account that for the Chromium port, |outNSFont| isn't necessarily the same
210 // font as |nsFont|. This because the sandbox may block loading of the origi nal font. 183 // font as |nsFont|. This because the sandbox may block loading of the origi nal font.
211 // * outNSFont - The font that was actually loaded, for the Chromium port th is may be different than nsFont. 184 // * outNSFont - The font that was actually loaded, for the Chromium port th is may be different than nsFont.
212 // The caller is responsible for calling CFRelease() on this parameter when done with it. 185 // The caller is responsible for calling CFRelease() on this parameter when done with it.
213 // * cgFont - CGFontRef representing the input font at the specified point s ize. 186 // * cgFont - CGFontRef representing the input font at the specified point s ize.
214 void loadFont(NSFont*, float fontSize, NSFont*& outNSFont, CGFontRef&); 187 void loadFont(NSFont*, float fontSize, NSFont*& outNSFont, CGFontRef&);
215 static NSFont* hashTableDeletedFontValue() { return reinterpret_cast<NSFont *>(-1); } 188 static NSFont* hashTableDeletedFontValue() { return reinterpret_cast<NSFont *>(-1); }
216 #elif PLATFORM(WIN)
217 void platformDataInit(HFONT, float size, HDC, WCHAR* faceName);
218 #endif 189 #endif
219 190
220 public: 191 public:
221 bool m_syntheticBold; 192 bool m_syntheticBold;
222 bool m_syntheticOblique; 193 bool m_syntheticOblique;
223 FontOrientation m_orientation; 194 FontOrientation m_orientation;
224 float m_size; 195 float m_size;
225 FontWidthVariant m_widthVariant; 196 FontWidthVariant m_widthVariant;
226 197
227 private: 198 private:
228 #if OS(DARWIN) 199 #if OS(DARWIN)
229 NSFont* m_font; 200 NSFont* m_font;
230 #elif PLATFORM(WIN)
231 RefPtr<RefCountedGDIHandle<HFONT> > m_font;
232 #endif 201 #endif
233 202
234 #if USE(CG) || USE(SKIA_ON_MAC_CHROMIUM) 203 #if USE(CG) || USE(SKIA_ON_MAC_CHROMIUM)
235 #if PLATFORM(WIN)
236 RetainPtr<CGFontRef> m_cgFont;
237 #else
238 RetainPtr<CGFontRef> m_cgFont; 204 RetainPtr<CGFontRef> m_cgFont;
239 mutable RetainPtr<CTFontRef> m_CTFont; 205 mutable RetainPtr<CTFontRef> m_CTFont;
240 #endif 206 #endif
241 #endif
242 207
243 #if PLATFORM(CHROMIUM) && OS(DARWIN) 208 #if PLATFORM(CHROMIUM) && OS(DARWIN)
244 RefPtr<MemoryActivatedFont> m_inMemoryFont; 209 RefPtr<MemoryActivatedFont> m_inMemoryFont;
245 RefPtr<HarfBuzzFace> m_harfBuzzFace; 210 RefPtr<HarfBuzzFace> m_harfBuzzFace;
246 #endif 211 #endif
247 212
248 bool m_isColorBitmapFont; 213 bool m_isColorBitmapFont;
249 bool m_isCompositeFontReference; 214 bool m_isCompositeFontReference;
250 #if OS(DARWIN) 215 #if OS(DARWIN)
251 bool m_isPrinterFont; 216 bool m_isPrinterFont;
252 #endif 217 #endif
253
254 #if PLATFORM(WIN)
255 bool m_useGDI;
256 #endif
257 }; 218 };
258 219
259 } // namespace WebCore 220 } // namespace WebCore
260 221
261 #endif // FontPlatformData_h 222 #endif // FontPlatformData_h
262 223
263 #endif 224 #endif
OLDNEW
« no previous file with comments | « Source/WebCore/platform/graphics/Font.h ('k') | Source/WebCore/platform/graphics/GlyphBuffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698