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

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

Issue 13905007: Remove the last remaining PLATFORM() bits from WebCore. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: fffffffffff 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
OLDNEW
1 /* 1 /*
2 * This file is part of the internal font implementation. 2 * This file is part of the internal font implementation.
3 * 3 *
4 * Copyright (C) 2006, 2008, 2010 Apple Inc. All rights reserved. 4 * Copyright (C) 2006, 2008, 2010 Apple Inc. All rights reserved.
5 * Copyright (C) 2007-2008 Torch Mobile, Inc. 5 * Copyright (C) 2007-2008 Torch Mobile, Inc.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 23 matching lines...) Expand all
34 #include "GlyphPageTreeNode.h" 34 #include "GlyphPageTreeNode.h"
35 #if ENABLE(OPENTYPE_VERTICAL) 35 #if ENABLE(OPENTYPE_VERTICAL)
36 #include "OpenTypeVerticalData.h" 36 #include "OpenTypeVerticalData.h"
37 #endif 37 #endif
38 #include "TypesettingFeatures.h" 38 #include "TypesettingFeatures.h"
39 #include <wtf/OwnPtr.h> 39 #include <wtf/OwnPtr.h>
40 #include <wtf/PassOwnPtr.h> 40 #include <wtf/PassOwnPtr.h>
41 #include <wtf/UnusedParam.h> 41 #include <wtf/UnusedParam.h>
42 #include <wtf/text/StringHash.h> 42 #include <wtf/text/StringHash.h>
43 43
44 #if PLATFORM(MAC) || (PLATFORM(CHROMIUM) && OS(DARWIN)) 44 #if OS(DARWIN)
45 #include <wtf/RetainPtr.h> 45 #include <wtf/RetainPtr.h>
46 #endif 46 #endif
47 47
48 #if PLATFORM(WIN) && !OS(WINCE)
49 #include <usp10.h>
50 #endif
51
52 namespace WebCore { 48 namespace WebCore {
53 49
54 class FontDescription; 50 class FontDescription;
55 class SharedBuffer; 51 class SharedBuffer;
56 struct WidthIterator; 52 struct WidthIterator;
57 53
58 enum FontDataVariant { AutoVariant, NormalVariant, SmallCapsVariant, EmphasisMar kVariant, BrokenIdeographVariant }; 54 enum FontDataVariant { AutoVariant, NormalVariant, SmallCapsVariant, EmphasisMar kVariant, BrokenIdeographVariant };
59 enum Pitch { UnknownPitch, FixedPitch, VariablePitch }; 55 enum Pitch { UnknownPitch, FixedPitch, VariablePitch };
60 56
61 class SimpleFontData : public FontData { 57 class SimpleFontData : public FontData {
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 virtual bool isLoading() const { return m_isLoading; } 161 virtual bool isLoading() const { return m_isLoading; }
166 virtual bool isSegmented() const; 162 virtual bool isSegmented() const;
167 163
168 const GlyphData& missingGlyphData() const { return m_missingGlyphData; } 164 const GlyphData& missingGlyphData() const { return m_missingGlyphData; }
169 void setMissingGlyphData(const GlyphData& glyphData) { m_missingGlyphData = glyphData; } 165 void setMissingGlyphData(const GlyphData& glyphData) { m_missingGlyphData = glyphData; }
170 166
171 #ifndef NDEBUG 167 #ifndef NDEBUG
172 virtual String description() const; 168 virtual String description() const;
173 #endif 169 #endif
174 170
175 #if PLATFORM(MAC) || (PLATFORM(CHROMIUM) && OS(DARWIN)) 171 #if OS(DARWIN)
176 const SimpleFontData* getCompositeFontReferenceFontData(NSFont *key) const; 172 const SimpleFontData* getCompositeFontReferenceFontData(NSFont *key) const;
177 NSFont* getNSFont() const { return m_platformData.font(); } 173 NSFont* getNSFont() const { return m_platformData.font(); }
178 #endif 174 #endif
179 175
180 #if PLATFORM(MAC) || (PLATFORM(CHROMIUM) && OS(DARWIN)) 176 #if OS(DARWIN)
181 CFDictionaryRef getCFStringAttributes(TypesettingFeatures, FontOrientation) const; 177 CFDictionaryRef getCFStringAttributes(TypesettingFeatures, FontOrientation) const;
182 #endif 178 #endif
183 179
184 #if PLATFORM(MAC) || (PLATFORM(CHROMIUM) && OS(DARWIN)) || USE(HARFBUZZ) 180 #if OS(DARWIN) || USE(HARFBUZZ)
185 bool canRenderCombiningCharacterSequence(const UChar*, size_t) const; 181 bool canRenderCombiningCharacterSequence(const UChar*, size_t) const;
186 #endif 182 #endif
187 183
188 bool applyTransforms(GlyphBufferGlyph* glyphs, GlyphBufferAdvance* advances, size_t glyphCount, TypesettingFeatures typesettingFeatures) const 184 bool applyTransforms(GlyphBufferGlyph* glyphs, GlyphBufferAdvance* advances, size_t glyphCount, TypesettingFeatures typesettingFeatures) const
189 { 185 {
190 UNUSED_PARAM(glyphs); 186 UNUSED_PARAM(glyphs);
191 UNUSED_PARAM(advances); 187 UNUSED_PARAM(advances);
192 UNUSED_PARAM(glyphCount); 188 UNUSED_PARAM(glyphCount);
193 UNUSED_PARAM(typesettingFeatures); 189 UNUSED_PARAM(typesettingFeatures);
194 return false; 190 return false;
195 } 191 }
196 192
197 private: 193 private:
198 SimpleFontData(const FontPlatformData&, bool isCustomFont = false, bool isLo ading = false, bool isTextOrientationFallback = false); 194 SimpleFontData(const FontPlatformData&, bool isCustomFont = false, bool isLo ading = false, bool isTextOrientationFallback = false);
199 195
200 SimpleFontData(PassOwnPtr<AdditionalFontData> , float fontSize, bool synthet icBold, bool syntheticItalic); 196 SimpleFontData(PassOwnPtr<AdditionalFontData> , float fontSize, bool synthet icBold, bool syntheticItalic);
201 197
202 void platformInit(); 198 void platformInit();
203 void platformGlyphInit(); 199 void platformGlyphInit();
204 void platformCharWidthInit(); 200 void platformCharWidthInit();
205 void platformDestroy(); 201 void platformDestroy();
206 202
207 void initCharWidths(); 203 void initCharWidths();
208 204
209 PassRefPtr<SimpleFontData> createScaledFontData(const FontDescription&, floa t scaleFactor) const; 205 PassRefPtr<SimpleFontData> createScaledFontData(const FontDescription&, floa t scaleFactor) const;
210 PassRefPtr<SimpleFontData> platformCreateScaledFontData(const FontDescriptio n&, float scaleFactor) const; 206 PassRefPtr<SimpleFontData> platformCreateScaledFontData(const FontDescriptio n&, float scaleFactor) const;
211 207
212 #if PLATFORM(WIN) && !OS(WINCE)
213 void initGDIFont();
214 void platformCommonDestroy();
215 FloatRect boundsForGDIGlyph(Glyph glyph) const;
216 float widthForGDIGlyph(Glyph glyph) const;
217 #endif
218
219 FontMetrics m_fontMetrics; 208 FontMetrics m_fontMetrics;
220 float m_maxCharWidth; 209 float m_maxCharWidth;
221 float m_avgCharWidth; 210 float m_avgCharWidth;
222 211
223 FontPlatformData m_platformData; 212 FontPlatformData m_platformData;
224 OwnPtr<AdditionalFontData> m_fontData; 213 OwnPtr<AdditionalFontData> m_fontData;
225 214
226 mutable OwnPtr<GlyphMetricsMap<FloatRect> > m_glyphToBoundsMap; 215 mutable OwnPtr<GlyphMetricsMap<FloatRect> > m_glyphToBoundsMap;
227 mutable GlyphMetricsMap<float> m_glyphToWidthMap; 216 mutable GlyphMetricsMap<float> m_glyphToWidthMap;
228 217
(...skipping 20 matching lines...) Expand all
249 struct DerivedFontData { 238 struct DerivedFontData {
250 static PassOwnPtr<DerivedFontData> create(bool forCustomFont); 239 static PassOwnPtr<DerivedFontData> create(bool forCustomFont);
251 ~DerivedFontData(); 240 ~DerivedFontData();
252 241
253 bool forCustomFont; 242 bool forCustomFont;
254 RefPtr<SimpleFontData> smallCaps; 243 RefPtr<SimpleFontData> smallCaps;
255 RefPtr<SimpleFontData> emphasisMark; 244 RefPtr<SimpleFontData> emphasisMark;
256 RefPtr<SimpleFontData> brokenIdeograph; 245 RefPtr<SimpleFontData> brokenIdeograph;
257 RefPtr<SimpleFontData> verticalRightOrientation; 246 RefPtr<SimpleFontData> verticalRightOrientation;
258 RefPtr<SimpleFontData> uprightOrientation; 247 RefPtr<SimpleFontData> uprightOrientation;
259 #if PLATFORM(MAC) || (PLATFORM(CHROMIUM) && OS(DARWIN)) 248 #if OS(DARWIN)
260 mutable RetainPtr<CFMutableDictionaryRef> compositeFontReferences; 249 mutable RetainPtr<CFMutableDictionaryRef> compositeFontReferences;
261 #endif 250 #endif
262 251
263 private: 252 private:
264 DerivedFontData(bool custom) 253 DerivedFontData(bool custom)
265 : forCustomFont(custom) 254 : forCustomFont(custom)
266 { 255 {
267 } 256 }
268 }; 257 };
269 258
270 mutable OwnPtr<DerivedFontData> m_derivedFontData; 259 mutable OwnPtr<DerivedFontData> m_derivedFontData;
271 260
272 #if USE(SKIA_ON_MAC_CHROMIUM) 261 #if USE(SKIA_ON_MAC_CHROMIUM)
273 float m_syntheticBoldOffset; 262 float m_syntheticBoldOffset;
274 #endif 263 #endif
275 264
276 #if PLATFORM(MAC) || (PLATFORM(CHROMIUM) && OS(DARWIN)) 265 #if OS(DARWIN)
277 mutable HashMap<unsigned, RetainPtr<CFDictionaryRef> > m_CFStringAttributes; 266 mutable HashMap<unsigned, RetainPtr<CFDictionaryRef> > m_CFStringAttributes;
278 #endif 267 #endif
279 268
280 #if PLATFORM(MAC) || (PLATFORM(CHROMIUM) && OS(DARWIN)) || USE(HARFBUZZ) 269 #if OS(DARWIN) || USE(HARFBUZZ)
281 mutable OwnPtr<HashMap<String, bool> > m_combiningCharacterSequenceSupport; 270 mutable OwnPtr<HashMap<String, bool> > m_combiningCharacterSequenceSupport;
282 #endif 271 #endif
283 }; 272 };
284 273
285 ALWAYS_INLINE FloatRect SimpleFontData::boundsForGlyph(Glyph glyph) const 274 ALWAYS_INLINE FloatRect SimpleFontData::boundsForGlyph(Glyph glyph) const
286 { 275 {
287 if (isZeroWidthSpaceGlyph(glyph)) 276 if (isZeroWidthSpaceGlyph(glyph))
288 return FloatRect(); 277 return FloatRect();
289 278
290 FloatRect bounds; 279 FloatRect bounds;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 #endif 311 #endif
323 else 312 else
324 width = platformWidthForGlyph(glyph); 313 width = platformWidthForGlyph(glyph);
325 314
326 m_glyphToWidthMap.setMetricsForGlyph(glyph, width); 315 m_glyphToWidthMap.setMetricsForGlyph(glyph, width);
327 return width; 316 return width;
328 } 317 }
329 318
330 } // namespace WebCore 319 } // namespace WebCore
331 #endif // SimpleFontData_h 320 #endif // SimpleFontData_h
OLDNEW
« no previous file with comments | « Source/WebCore/platform/graphics/GlyphBuffer.h ('k') | Source/WebCore/platform/graphics/cocoa/FontPlatformDataCocoa.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698