OLD | NEW |
---|---|
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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
62 static PassRefPtr<SimpleFontData> create(PassRefPtr<CustomFontData> customDa ta, float fontSize, bool syntheticBold, bool syntheticItalic) | 62 static PassRefPtr<SimpleFontData> create(PassRefPtr<CustomFontData> customDa ta, float fontSize, bool syntheticBold, bool syntheticItalic) |
63 { | 63 { |
64 return adoptRef(new SimpleFontData(customData, fontSize, syntheticBold, syntheticItalic)); | 64 return adoptRef(new SimpleFontData(customData, fontSize, syntheticBold, syntheticItalic)); |
65 } | 65 } |
66 | 66 |
67 virtual ~SimpleFontData(); | 67 virtual ~SimpleFontData(); |
68 | 68 |
69 static const SimpleFontData* systemFallback() { return reinterpret_cast<cons t SimpleFontData*>(-1); } | 69 static const SimpleFontData* systemFallback() { return reinterpret_cast<cons t SimpleFontData*>(-1); } |
70 | 70 |
71 const FontPlatformData& platformData() const { return m_platformData; } | 71 const FontPlatformData& platformData() const { return m_platformData; } |
72 #if ENABLE(OPENTYPE_VERTICAL) | |
73 const OpenTypeVerticalData* verticalData() const { return m_verticalData.get (); } | 72 const OpenTypeVerticalData* verticalData() const { return m_verticalData.get (); } |
74 #endif | |
75 | 73 |
76 PassRefPtr<SimpleFontData> smallCapsFontData(const FontDescription&) const; | 74 PassRefPtr<SimpleFontData> smallCapsFontData(const FontDescription&) const; |
77 PassRefPtr<SimpleFontData> emphasisMarkFontData(const FontDescription&) cons t; | 75 PassRefPtr<SimpleFontData> emphasisMarkFontData(const FontDescription&) cons t; |
78 PassRefPtr<SimpleFontData> brokenIdeographFontData() const; | 76 PassRefPtr<SimpleFontData> brokenIdeographFontData() const; |
79 | 77 |
80 PassRefPtr<SimpleFontData> variantFontData(const FontDescription& descriptio n, FontDataVariant variant) const | 78 PassRefPtr<SimpleFontData> variantFontData(const FontDescription& descriptio n, FontDataVariant variant) const |
81 { | 79 { |
82 switch (variant) { | 80 switch (variant) { |
83 case SmallCapsVariant: | 81 case SmallCapsVariant: |
84 return smallCapsFontData(description); | 82 return smallCapsFontData(description); |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
185 | 183 |
186 FontPlatformData m_platformData; | 184 FontPlatformData m_platformData; |
187 | 185 |
188 mutable OwnPtr<GlyphMetricsMap<FloatRect> > m_glyphToBoundsMap; | 186 mutable OwnPtr<GlyphMetricsMap<FloatRect> > m_glyphToBoundsMap; |
189 mutable GlyphMetricsMap<float> m_glyphToWidthMap; | 187 mutable GlyphMetricsMap<float> m_glyphToWidthMap; |
190 | 188 |
191 bool m_treatAsFixedPitch; | 189 bool m_treatAsFixedPitch; |
192 | 190 |
193 bool m_isTextOrientationFallback; | 191 bool m_isTextOrientationFallback; |
194 bool m_isBrokenIdeographFallback; | 192 bool m_isBrokenIdeographFallback; |
195 #if ENABLE(OPENTYPE_VERTICAL) | |
196 RefPtr<OpenTypeVerticalData> m_verticalData; | 193 RefPtr<OpenTypeVerticalData> m_verticalData; |
197 #endif | |
198 bool m_hasVerticalGlyphs; | 194 bool m_hasVerticalGlyphs; |
199 | 195 |
200 Glyph m_spaceGlyph; | 196 Glyph m_spaceGlyph; |
201 float m_spaceWidth; | 197 float m_spaceWidth; |
202 Glyph m_zeroGlyph; | 198 Glyph m_zeroGlyph; |
203 | 199 |
204 Glyph m_zeroWidthSpaceGlyph; | 200 Glyph m_zeroWidthSpaceGlyph; |
205 | 201 |
206 GlyphData m_missingGlyphData; | 202 GlyphData m_missingGlyphData; |
207 | 203 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
262 { | 258 { |
263 if (isZeroWidthSpaceGlyph(glyph)) | 259 if (isZeroWidthSpaceGlyph(glyph)) |
264 return 0; | 260 return 0; |
265 | 261 |
266 float width = m_glyphToWidthMap.metricsForGlyph(glyph); | 262 float width = m_glyphToWidthMap.metricsForGlyph(glyph); |
267 if (width != cGlyphSizeUnknown) | 263 if (width != cGlyphSizeUnknown) |
268 return width; | 264 return width; |
269 | 265 |
270 if (isSVGFont()) | 266 if (isSVGFont()) |
271 width = m_customFontData->widthForSVGGlyph(glyph, m_platformData.size()) ; | 267 width = m_customFontData->widthForSVGGlyph(glyph, m_platformData.size()) ; |
272 #if ENABLE(OPENTYPE_VERTICAL) | |
273 else if (m_verticalData) | 268 else if (m_verticalData) |
274 #if OS(MACOSX) | 269 #if OS(MACOSX) |
275 width = m_verticalData->advanceHeight(this, glyph) + m_syntheticBoldOffs et; | 270 width = m_verticalData->advanceHeight(this, glyph) + m_syntheticBoldOffs et; |
behdad_google
2014/10/01 16:02:30
We shouldn't need any of these, right? We don't w
d.roettsches
2014/10/01 17:05:00
You mean the whole "else if (m_verticalData)" bran
| |
276 #else | 271 #else |
277 width = m_verticalData->advanceHeight(this, glyph); | 272 width = m_verticalData->advanceHeight(this, glyph); |
278 #endif | 273 #endif |
279 #endif | |
280 else | 274 else |
281 width = platformWidthForGlyph(glyph); | 275 width = platformWidthForGlyph(glyph); |
282 | 276 |
283 m_glyphToWidthMap.setMetricsForGlyph(glyph, width); | 277 m_glyphToWidthMap.setMetricsForGlyph(glyph, width); |
284 return width; | 278 return width; |
285 } | 279 } |
286 | 280 |
287 DEFINE_FONT_DATA_TYPE_CASTS(SimpleFontData, false); | 281 DEFINE_FONT_DATA_TYPE_CASTS(SimpleFontData, false); |
288 | 282 |
289 } // namespace blink | 283 } // namespace blink |
290 #endif // SimpleFontData_h | 284 #endif // SimpleFontData_h |
OLD | NEW |