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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 public: | 54 public: |
55 // Used to create platform fonts. | 55 // Used to create platform fonts. |
56 static PassRefPtr<SimpleFontData> create(const FontPlatformData& platformDat
a, PassRefPtr<CustomFontData> customData = nullptr, bool isTextOrientationFallba
ck = false) | 56 static PassRefPtr<SimpleFontData> create(const FontPlatformData& platformDat
a, PassRefPtr<CustomFontData> customData = nullptr, bool isTextOrientationFallba
ck = false) |
57 { | 57 { |
58 return adoptRef(new SimpleFontData(platformData, customData, isTextOrien
tationFallback)); | 58 return adoptRef(new SimpleFontData(platformData, customData, isTextOrien
tationFallback)); |
59 } | 59 } |
60 | 60 |
61 virtual ~SimpleFontData(); | 61 virtual ~SimpleFontData(); |
62 | 62 |
63 const FontPlatformData& platformData() const { return m_platformData; } | 63 const FontPlatformData& platformData() const { return m_platformData; } |
64 #if ENABLE(OPENTYPE_VERTICAL) | |
65 const OpenTypeVerticalData* verticalData() const { return m_verticalData.get
(); } | 64 const OpenTypeVerticalData* verticalData() const { return m_verticalData.get
(); } |
66 #endif | |
67 | 65 |
68 PassRefPtr<SimpleFontData> smallCapsFontData(const FontDescription&) const; | 66 PassRefPtr<SimpleFontData> smallCapsFontData(const FontDescription&) const; |
69 PassRefPtr<SimpleFontData> emphasisMarkFontData(const FontDescription&) cons
t; | 67 PassRefPtr<SimpleFontData> emphasisMarkFontData(const FontDescription&) cons
t; |
70 PassRefPtr<SimpleFontData> brokenIdeographFontData() const; | 68 PassRefPtr<SimpleFontData> brokenIdeographFontData() const; |
71 | 69 |
72 PassRefPtr<SimpleFontData> variantFontData(const FontDescription& descriptio
n, FontDataVariant variant) const | 70 PassRefPtr<SimpleFontData> variantFontData(const FontDescription& descriptio
n, FontDataVariant variant) const |
73 { | 71 { |
74 switch (variant) { | 72 switch (variant) { |
75 case SmallCapsVariant: | 73 case SmallCapsVariant: |
76 return smallCapsFontData(description); | 74 return smallCapsFontData(description); |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 | 161 |
164 FontPlatformData m_platformData; | 162 FontPlatformData m_platformData; |
165 | 163 |
166 mutable OwnPtr<GlyphMetricsMap<FloatRect> > m_glyphToBoundsMap; | 164 mutable OwnPtr<GlyphMetricsMap<FloatRect> > m_glyphToBoundsMap; |
167 mutable GlyphMetricsMap<float> m_glyphToWidthMap; | 165 mutable GlyphMetricsMap<float> m_glyphToWidthMap; |
168 | 166 |
169 bool m_treatAsFixedPitch; | 167 bool m_treatAsFixedPitch; |
170 | 168 |
171 bool m_isTextOrientationFallback; | 169 bool m_isTextOrientationFallback; |
172 bool m_isBrokenIdeographFallback; | 170 bool m_isBrokenIdeographFallback; |
173 #if ENABLE(OPENTYPE_VERTICAL) | |
174 RefPtr<OpenTypeVerticalData> m_verticalData; | 171 RefPtr<OpenTypeVerticalData> m_verticalData; |
175 #endif | |
176 bool m_hasVerticalGlyphs; | 172 bool m_hasVerticalGlyphs; |
177 | 173 |
178 Glyph m_spaceGlyph; | 174 Glyph m_spaceGlyph; |
179 float m_spaceWidth; | 175 float m_spaceWidth; |
180 Glyph m_zeroGlyph; | 176 Glyph m_zeroGlyph; |
181 | 177 |
182 Glyph m_zeroWidthSpaceGlyph; | 178 Glyph m_zeroWidthSpaceGlyph; |
183 | 179 |
184 GlyphData m_missingGlyphData; | 180 GlyphData m_missingGlyphData; |
185 | 181 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 | 224 |
229 ALWAYS_INLINE float SimpleFontData::widthForGlyph(Glyph glyph) const | 225 ALWAYS_INLINE float SimpleFontData::widthForGlyph(Glyph glyph) const |
230 { | 226 { |
231 if (isZeroWidthSpaceGlyph(glyph)) | 227 if (isZeroWidthSpaceGlyph(glyph)) |
232 return 0; | 228 return 0; |
233 | 229 |
234 float width = m_glyphToWidthMap.metricsForGlyph(glyph); | 230 float width = m_glyphToWidthMap.metricsForGlyph(glyph); |
235 if (width != cGlyphSizeUnknown) | 231 if (width != cGlyphSizeUnknown) |
236 return width; | 232 return width; |
237 | 233 |
238 #if ENABLE(OPENTYPE_VERTICAL) | 234 width = platformWidthForGlyph(glyph); |
239 if (m_verticalData) | |
240 width = m_verticalData->advanceHeight(this, glyph); | |
241 else | |
242 #endif | |
243 width = platformWidthForGlyph(glyph); | |
244 | 235 |
245 m_glyphToWidthMap.setMetricsForGlyph(glyph, width); | 236 m_glyphToWidthMap.setMetricsForGlyph(glyph, width); |
246 return width; | 237 return width; |
247 } | 238 } |
248 | 239 |
249 DEFINE_FONT_DATA_TYPE_CASTS(SimpleFontData, false); | 240 DEFINE_FONT_DATA_TYPE_CASTS(SimpleFontData, false); |
250 | 241 |
251 } // namespace blink | 242 } // namespace blink |
252 #endif // SimpleFontData_h | 243 #endif // SimpleFontData_h |
OLD | NEW |