| 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 29 matching lines...) Expand all Loading... |
| 40 #include "wtf/text/StringHash.h" | 40 #include "wtf/text/StringHash.h" |
| 41 | 41 |
| 42 #if OS(MACOSX) | 42 #if OS(MACOSX) |
| 43 #include "wtf/RetainPtr.h" | 43 #include "wtf/RetainPtr.h" |
| 44 #endif | 44 #endif |
| 45 | 45 |
| 46 namespace blink { | 46 namespace blink { |
| 47 | 47 |
| 48 class FontDescription; | 48 class FontDescription; |
| 49 | 49 |
| 50 enum FontDataVariant { AutoVariant, NormalVariant, SmallCapsVariant, EmphasisMar
kVariant, BrokenIdeographVariant }; | 50 enum FontDataVariant { AutoVariant, NormalVariant, SmallCapsVariant, EmphasisMar
kVariant }; |
| 51 | 51 |
| 52 class PLATFORM_EXPORT SimpleFontData : public FontData { | 52 class PLATFORM_EXPORT SimpleFontData : public FontData { |
| 53 public: | 53 public: |
| 54 // Used to create platform fonts. | 54 // Used to create platform fonts. |
| 55 static PassRefPtr<SimpleFontData> create(const FontPlatformData& platformDat
a, PassRefPtr<CustomFontData> customData = nullptr, bool isTextOrientationFallba
ck = false) | 55 static PassRefPtr<SimpleFontData> create(const FontPlatformData& platformDat
a, PassRefPtr<CustomFontData> customData = nullptr, bool isTextOrientationFallba
ck = false) |
| 56 { | 56 { |
| 57 return adoptRef(new SimpleFontData(platformData, customData, isTextOrien
tationFallback)); | 57 return adoptRef(new SimpleFontData(platformData, customData, isTextOrien
tationFallback)); |
| 58 } | 58 } |
| 59 | 59 |
| 60 virtual ~SimpleFontData(); | 60 virtual ~SimpleFontData(); |
| 61 | 61 |
| 62 const FontPlatformData& platformData() const { return m_platformData; } | 62 const FontPlatformData& platformData() const { return m_platformData; } |
| 63 const OpenTypeVerticalData* verticalData() const { return m_verticalData.get
(); } | 63 const OpenTypeVerticalData* verticalData() const { return m_verticalData.get
(); } |
| 64 | 64 |
| 65 PassRefPtr<SimpleFontData> smallCapsFontData(const FontDescription&) const; | 65 PassRefPtr<SimpleFontData> smallCapsFontData(const FontDescription&) const; |
| 66 PassRefPtr<SimpleFontData> emphasisMarkFontData(const FontDescription&) cons
t; | 66 PassRefPtr<SimpleFontData> emphasisMarkFontData(const FontDescription&) cons
t; |
| 67 PassRefPtr<SimpleFontData> brokenIdeographFontData() const; | |
| 68 | 67 |
| 69 PassRefPtr<SimpleFontData> variantFontData(const FontDescription& descriptio
n, FontDataVariant variant) const | 68 PassRefPtr<SimpleFontData> variantFontData(const FontDescription& descriptio
n, FontDataVariant variant) const |
| 70 { | 69 { |
| 71 switch (variant) { | 70 switch (variant) { |
| 72 case SmallCapsVariant: | 71 case SmallCapsVariant: |
| 73 return smallCapsFontData(description); | 72 return smallCapsFontData(description); |
| 74 case EmphasisMarkVariant: | 73 case EmphasisMarkVariant: |
| 75 return emphasisMarkFontData(description); | 74 return emphasisMarkFontData(description); |
| 76 case BrokenIdeographVariant: | |
| 77 return brokenIdeographFontData(); | |
| 78 case AutoVariant: | 75 case AutoVariant: |
| 79 case NormalVariant: | 76 case NormalVariant: |
| 80 break; | 77 break; |
| 81 } | 78 } |
| 82 ASSERT_NOT_REACHED(); | 79 ASSERT_NOT_REACHED(); |
| 83 return const_cast<SimpleFontData*>(this); | 80 return const_cast<SimpleFontData*>(this); |
| 84 } | 81 } |
| 85 | 82 |
| 86 PassRefPtr<SimpleFontData> verticalRightOrientationFontData() const; | 83 PassRefPtr<SimpleFontData> verticalRightOrientationFontData() const; |
| 87 PassRefPtr<SimpleFontData> uprightOrientationFontData() const; | 84 PassRefPtr<SimpleFontData> uprightOrientationFontData() const; |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 FontMetrics m_fontMetrics; | 147 FontMetrics m_fontMetrics; |
| 151 float m_maxCharWidth; | 148 float m_maxCharWidth; |
| 152 float m_avgCharWidth; | 149 float m_avgCharWidth; |
| 153 | 150 |
| 154 FontPlatformData m_platformData; | 151 FontPlatformData m_platformData; |
| 155 | 152 |
| 156 mutable OwnPtr<GlyphMetricsMap<FloatRect>> m_glyphToBoundsMap; | 153 mutable OwnPtr<GlyphMetricsMap<FloatRect>> m_glyphToBoundsMap; |
| 157 mutable GlyphMetricsMap<float> m_glyphToWidthMap; | 154 mutable GlyphMetricsMap<float> m_glyphToWidthMap; |
| 158 | 155 |
| 159 bool m_isTextOrientationFallback; | 156 bool m_isTextOrientationFallback; |
| 160 bool m_isBrokenIdeographFallback; | |
| 161 RefPtr<OpenTypeVerticalData> m_verticalData; | 157 RefPtr<OpenTypeVerticalData> m_verticalData; |
| 162 bool m_hasVerticalGlyphs; | 158 bool m_hasVerticalGlyphs; |
| 163 | 159 |
| 164 Glyph m_spaceGlyph; | 160 Glyph m_spaceGlyph; |
| 165 float m_spaceWidth; | 161 float m_spaceWidth; |
| 166 Glyph m_zeroGlyph; | 162 Glyph m_zeroGlyph; |
| 167 | 163 |
| 168 Glyph m_zeroWidthSpaceGlyph; | 164 Glyph m_zeroWidthSpaceGlyph; |
| 169 | 165 |
| 170 GlyphData m_missingGlyphData; | 166 GlyphData m_missingGlyphData; |
| 171 | 167 |
| 172 struct DerivedFontData { | 168 struct DerivedFontData { |
| 173 static PassOwnPtr<DerivedFontData> create(bool forCustomFont); | 169 static PassOwnPtr<DerivedFontData> create(bool forCustomFont); |
| 174 ~DerivedFontData(); | 170 ~DerivedFontData(); |
| 175 | 171 |
| 176 bool forCustomFont; | 172 bool forCustomFont; |
| 177 RefPtr<SimpleFontData> smallCaps; | 173 RefPtr<SimpleFontData> smallCaps; |
| 178 RefPtr<SimpleFontData> emphasisMark; | 174 RefPtr<SimpleFontData> emphasisMark; |
| 179 RefPtr<SimpleFontData> brokenIdeograph; | |
| 180 RefPtr<SimpleFontData> verticalRightOrientation; | 175 RefPtr<SimpleFontData> verticalRightOrientation; |
| 181 RefPtr<SimpleFontData> uprightOrientation; | 176 RefPtr<SimpleFontData> uprightOrientation; |
| 182 | 177 |
| 183 private: | 178 private: |
| 184 DerivedFontData(bool custom) | 179 DerivedFontData(bool custom) |
| 185 : forCustomFont(custom) | 180 : forCustomFont(custom) |
| 186 { | 181 { |
| 187 } | 182 } |
| 188 }; | 183 }; |
| 189 | 184 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 width = platformWidthForGlyph(glyph); | 219 width = platformWidthForGlyph(glyph); |
| 225 | 220 |
| 226 m_glyphToWidthMap.setMetricsForGlyph(glyph, width); | 221 m_glyphToWidthMap.setMetricsForGlyph(glyph, width); |
| 227 return width; | 222 return width; |
| 228 } | 223 } |
| 229 | 224 |
| 230 DEFINE_FONT_DATA_TYPE_CASTS(SimpleFontData, false); | 225 DEFINE_FONT_DATA_TYPE_CASTS(SimpleFontData, false); |
| 231 | 226 |
| 232 } // namespace blink | 227 } // namespace blink |
| 233 #endif // SimpleFontData_h | 228 #endif // SimpleFontData_h |
| OLD | NEW |