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

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

Issue 14107015: Rename OS(DARWIN) to OS(MACOSX). (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 7 years, 3 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
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 "core/platform/graphics/GlyphPageTreeNode.h" 34 #include "core/platform/graphics/GlyphPageTreeNode.h"
35 #if ENABLE(OPENTYPE_VERTICAL) 35 #if ENABLE(OPENTYPE_VERTICAL)
36 #include "core/platform/graphics/opentype/OpenTypeVerticalData.h" 36 #include "core/platform/graphics/opentype/OpenTypeVerticalData.h"
37 #endif 37 #endif
38 #include "core/platform/graphics/TypesettingFeatures.h" 38 #include "core/platform/graphics/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/text/StringHash.h" 41 #include "wtf/text/StringHash.h"
42 #include "wtf/UnusedParam.h" 42 #include "wtf/UnusedParam.h"
43 43
44 #if OS(DARWIN) 44 #if OS(MACOSX)
45 #include "wtf/RetainPtr.h" 45 #include "wtf/RetainPtr.h"
46 #endif 46 #endif
47 47
48 namespace WebCore { 48 namespace WebCore {
49 49
50 class FontDescription; 50 class FontDescription;
51 class SharedBuffer; 51 class SharedBuffer;
52 struct WidthIterator; 52 struct WidthIterator;
53 53
54 enum FontDataVariant { AutoVariant, NormalVariant, SmallCapsVariant, EmphasisMar kVariant, BrokenIdeographVariant }; 54 enum FontDataVariant { AutoVariant, NormalVariant, SmallCapsVariant, EmphasisMar kVariant, BrokenIdeographVariant };
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 127
128 FloatRect boundsForGlyph(Glyph) const; 128 FloatRect boundsForGlyph(Glyph) const;
129 float widthForGlyph(Glyph glyph) const; 129 float widthForGlyph(Glyph glyph) const;
130 FloatRect platformBoundsForGlyph(Glyph) const; 130 FloatRect platformBoundsForGlyph(Glyph) const;
131 float platformWidthForGlyph(Glyph) const; 131 float platformWidthForGlyph(Glyph) const;
132 132
133 float spaceWidth() const { return m_spaceWidth; } 133 float spaceWidth() const { return m_spaceWidth; }
134 float adjustedSpaceWidth() const { return m_adjustedSpaceWidth; } 134 float adjustedSpaceWidth() const { return m_adjustedSpaceWidth; }
135 void setSpaceWidth(float spaceWidth) { m_spaceWidth = spaceWidth; } 135 void setSpaceWidth(float spaceWidth) { m_spaceWidth = spaceWidth; }
136 136
137 #if OS(DARWIN) 137 #if OS(MACOSX)
138 float syntheticBoldOffset() const { return m_syntheticBoldOffset; } 138 float syntheticBoldOffset() const { return m_syntheticBoldOffset; }
139 #endif 139 #endif
140 140
141 Glyph spaceGlyph() const { return m_spaceGlyph; } 141 Glyph spaceGlyph() const { return m_spaceGlyph; }
142 void setSpaceGlyph(Glyph spaceGlyph) { m_spaceGlyph = spaceGlyph; } 142 void setSpaceGlyph(Glyph spaceGlyph) { m_spaceGlyph = spaceGlyph; }
143 Glyph zeroWidthSpaceGlyph() const { return m_zeroWidthSpaceGlyph; } 143 Glyph zeroWidthSpaceGlyph() const { return m_zeroWidthSpaceGlyph; }
144 void setZeroWidthSpaceGlyph(Glyph spaceGlyph) { m_zeroWidthSpaceGlyph = spac eGlyph; } 144 void setZeroWidthSpaceGlyph(Glyph spaceGlyph) { m_zeroWidthSpaceGlyph = spac eGlyph; }
145 bool isZeroWidthSpaceGlyph(Glyph glyph) const { return glyph == m_zeroWidthS paceGlyph && glyph; } 145 bool isZeroWidthSpaceGlyph(Glyph glyph) const { return glyph == m_zeroWidthS paceGlyph && glyph; }
146 Glyph zeroGlyph() const { return m_zeroGlyph; } 146 Glyph zeroGlyph() const { return m_zeroGlyph; }
147 void setZeroGlyph(Glyph zeroGlyph) { m_zeroGlyph = zeroGlyph; } 147 void setZeroGlyph(Glyph zeroGlyph) { m_zeroGlyph = zeroGlyph; }
(...skipping 13 matching lines...) Expand all
161 virtual bool isLoading() const { return m_isLoading; } 161 virtual bool isLoading() const { return m_isLoading; }
162 virtual bool isSegmented() const; 162 virtual bool isSegmented() const;
163 163
164 const GlyphData& missingGlyphData() const { return m_missingGlyphData; } 164 const GlyphData& missingGlyphData() const { return m_missingGlyphData; }
165 void setMissingGlyphData(const GlyphData& glyphData) { m_missingGlyphData = glyphData; } 165 void setMissingGlyphData(const GlyphData& glyphData) { m_missingGlyphData = glyphData; }
166 166
167 #ifndef NDEBUG 167 #ifndef NDEBUG
168 virtual String description() const; 168 virtual String description() const;
169 #endif 169 #endif
170 170
171 #if OS(DARWIN) 171 #if OS(MACOSX)
172 const SimpleFontData* getCompositeFontReferenceFontData(NSFont *key) const; 172 const SimpleFontData* getCompositeFontReferenceFontData(NSFont *key) const;
173 NSFont* getNSFont() const { return m_platformData.font(); } 173 NSFont* getNSFont() const { return m_platformData.font(); }
174 #endif 174 #endif
175 175
176 #if OS(DARWIN) 176 #if OS(MACOSX)
177 CFDictionaryRef getCFStringAttributes(TypesettingFeatures, FontOrientation) const; 177 CFDictionaryRef getCFStringAttributes(TypesettingFeatures, FontOrientation) const;
178 #endif 178 #endif
179 179
180 #if OS(DARWIN) || USE(HARFBUZZ) 180 #if OS(MACOSX) || USE(HARFBUZZ)
181 bool canRenderCombiningCharacterSequence(const UChar*, size_t) const; 181 bool canRenderCombiningCharacterSequence(const UChar*, size_t) const;
182 #endif 182 #endif
183 183
184 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
185 { 185 {
186 UNUSED_PARAM(glyphs); 186 UNUSED_PARAM(glyphs);
187 UNUSED_PARAM(advances); 187 UNUSED_PARAM(advances);
188 UNUSED_PARAM(glyphCount); 188 UNUSED_PARAM(glyphCount);
189 UNUSED_PARAM(typesettingFeatures); 189 UNUSED_PARAM(typesettingFeatures);
190 return false; 190 return false;
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 struct DerivedFontData { 238 struct DerivedFontData {
239 static PassOwnPtr<DerivedFontData> create(bool forCustomFont); 239 static PassOwnPtr<DerivedFontData> create(bool forCustomFont);
240 ~DerivedFontData(); 240 ~DerivedFontData();
241 241
242 bool forCustomFont; 242 bool forCustomFont;
243 RefPtr<SimpleFontData> smallCaps; 243 RefPtr<SimpleFontData> smallCaps;
244 RefPtr<SimpleFontData> emphasisMark; 244 RefPtr<SimpleFontData> emphasisMark;
245 RefPtr<SimpleFontData> brokenIdeograph; 245 RefPtr<SimpleFontData> brokenIdeograph;
246 RefPtr<SimpleFontData> verticalRightOrientation; 246 RefPtr<SimpleFontData> verticalRightOrientation;
247 RefPtr<SimpleFontData> uprightOrientation; 247 RefPtr<SimpleFontData> uprightOrientation;
248 #if OS(DARWIN) 248 #if OS(MACOSX)
249 mutable RetainPtr<CFMutableDictionaryRef> compositeFontReferences; 249 mutable RetainPtr<CFMutableDictionaryRef> compositeFontReferences;
250 #endif 250 #endif
251 251
252 private: 252 private:
253 DerivedFontData(bool custom) 253 DerivedFontData(bool custom)
254 : forCustomFont(custom) 254 : forCustomFont(custom)
255 { 255 {
256 } 256 }
257 }; 257 };
258 258
259 mutable OwnPtr<DerivedFontData> m_derivedFontData; 259 mutable OwnPtr<DerivedFontData> m_derivedFontData;
260 260
261 #if OS(DARWIN) 261 #if OS(MACOSX)
262 float m_syntheticBoldOffset; 262 float m_syntheticBoldOffset;
263 263
264 mutable HashMap<unsigned, RetainPtr<CFDictionaryRef> > m_CFStringAttributes; 264 mutable HashMap<unsigned, RetainPtr<CFDictionaryRef> > m_CFStringAttributes;
265 #endif 265 #endif
266 266
267 #if OS(DARWIN) || USE(HARFBUZZ) 267 #if OS(MACOSX) || USE(HARFBUZZ)
268 mutable OwnPtr<HashMap<String, bool> > m_combiningCharacterSequenceSupport; 268 mutable OwnPtr<HashMap<String, bool> > m_combiningCharacterSequenceSupport;
269 #endif 269 #endif
270 }; 270 };
271 271
272 ALWAYS_INLINE FloatRect SimpleFontData::boundsForGlyph(Glyph glyph) const 272 ALWAYS_INLINE FloatRect SimpleFontData::boundsForGlyph(Glyph glyph) const
273 { 273 {
274 if (isZeroWidthSpaceGlyph(glyph)) 274 if (isZeroWidthSpaceGlyph(glyph))
275 return FloatRect(); 275 return FloatRect();
276 276
277 FloatRect bounds; 277 FloatRect bounds;
(...skipping 16 matching lines...) Expand all
294 return 0; 294 return 0;
295 295
296 float width = m_glyphToWidthMap.metricsForGlyph(glyph); 296 float width = m_glyphToWidthMap.metricsForGlyph(glyph);
297 if (width != cGlyphSizeUnknown) 297 if (width != cGlyphSizeUnknown)
298 return width; 298 return width;
299 299
300 if (m_fontData) 300 if (m_fontData)
301 width = m_fontData->widthForSVGGlyph(glyph, m_platformData.size()); 301 width = m_fontData->widthForSVGGlyph(glyph, m_platformData.size());
302 #if ENABLE(OPENTYPE_VERTICAL) 302 #if ENABLE(OPENTYPE_VERTICAL)
303 else if (m_verticalData) 303 else if (m_verticalData)
304 #if OS(DARWIN) 304 #if OS(MACOSX)
305 width = m_verticalData->advanceHeight(this, glyph) + m_syntheticBoldOffs et; 305 width = m_verticalData->advanceHeight(this, glyph) + m_syntheticBoldOffs et;
306 #else 306 #else
307 width = m_verticalData->advanceHeight(this, glyph); 307 width = m_verticalData->advanceHeight(this, glyph);
308 #endif 308 #endif
309 #endif 309 #endif
310 else 310 else
311 width = platformWidthForGlyph(glyph); 311 width = platformWidthForGlyph(glyph);
312 312
313 m_glyphToWidthMap.setMetricsForGlyph(glyph, width); 313 m_glyphToWidthMap.setMetricsForGlyph(glyph, width);
314 return width; 314 return width;
315 } 315 }
316 316
317 } // namespace WebCore 317 } // namespace WebCore
318 #endif // SimpleFontData_h 318 #endif // SimpleFontData_h
OLDNEW
« no previous file with comments | « Source/core/platform/graphics/IntSize.h ('k') | Source/core/platform/graphics/cocoa/FontPlatformDataCocoa.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698