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 SmallCapsVariant, | 62 SmallCapsVariant, |
63 EmphasisMarkVariant | 63 EmphasisMarkVariant |
64 }; | 64 }; |
65 | 65 |
66 class PLATFORM_EXPORT SimpleFontData : public FontData { | 66 class PLATFORM_EXPORT SimpleFontData : public FontData { |
67 public: | 67 public: |
68 // Used to create platform fonts. | 68 // Used to create platform fonts. |
69 static PassRefPtr<SimpleFontData> create( | 69 static PassRefPtr<SimpleFontData> create( |
70 const FontPlatformData& platformData, | 70 const FontPlatformData& platformData, |
71 PassRefPtr<CustomFontData> customData = nullptr, | 71 PassRefPtr<CustomFontData> customData = nullptr, |
72 bool isTextOrientationFallback = false, | 72 bool isTextOrientationFallback = false) { |
73 bool subpixelAscentDescent = false) { | |
74 return adoptRef(new SimpleFontData(platformData, std::move(customData), | 73 return adoptRef(new SimpleFontData(platformData, std::move(customData), |
75 isTextOrientationFallback, | 74 isTextOrientationFallback)); |
76 subpixelAscentDescent)); | |
77 } | 75 } |
78 | 76 |
79 const FontPlatformData& platformData() const { return m_platformData; } | 77 const FontPlatformData& platformData() const { return m_platformData; } |
80 const OpenTypeVerticalData* verticalData() const { | 78 const OpenTypeVerticalData* verticalData() const { |
81 return m_verticalData.get(); | 79 return m_verticalData.get(); |
82 } | 80 } |
83 | 81 |
84 PassRefPtr<SimpleFontData> smallCapsFontData(const FontDescription&) const; | 82 PassRefPtr<SimpleFontData> smallCapsFontData(const FontDescription&) const; |
85 PassRefPtr<SimpleFontData> emphasisMarkFontData(const FontDescription&) const; | 83 PassRefPtr<SimpleFontData> emphasisMarkFontData(const FontDescription&) const; |
86 | 84 |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 const GlyphData& missingGlyphData() const { return m_missingGlyphData; } | 152 const GlyphData& missingGlyphData() const { return m_missingGlyphData; } |
155 void setMissingGlyphData(const GlyphData& glyphData) { | 153 void setMissingGlyphData(const GlyphData& glyphData) { |
156 m_missingGlyphData = glyphData; | 154 m_missingGlyphData = glyphData; |
157 } | 155 } |
158 | 156 |
159 CustomFontData* customFontData() const { return m_customFontData.get(); } | 157 CustomFontData* customFontData() const { return m_customFontData.get(); } |
160 | 158 |
161 protected: | 159 protected: |
162 SimpleFontData(const FontPlatformData&, | 160 SimpleFontData(const FontPlatformData&, |
163 PassRefPtr<CustomFontData> customData, | 161 PassRefPtr<CustomFontData> customData, |
164 bool isTextOrientationFallback = false, | 162 bool isTextOrientationFallback = false); |
165 bool subpixelAscentDescent = false); | |
166 | 163 |
167 // Only used for testing. | 164 // Only used for testing. |
168 SimpleFontData(const FontPlatformData&, PassRefPtr<OpenTypeVerticalData>); | 165 SimpleFontData(const FontPlatformData&, PassRefPtr<OpenTypeVerticalData>); |
169 | 166 |
170 private: | 167 private: |
171 void platformInit(bool subpixelAscentDescent); | 168 void platformInit(); |
172 void platformGlyphInit(); | 169 void platformGlyphInit(); |
173 | 170 |
174 PassRefPtr<SimpleFontData> createScaledFontData(const FontDescription&, | 171 PassRefPtr<SimpleFontData> createScaledFontData(const FontDescription&, |
175 float scaleFactor) const; | 172 float scaleFactor) const; |
176 | 173 |
177 FontMetrics m_fontMetrics; | 174 FontMetrics m_fontMetrics; |
178 float m_maxCharWidth; | 175 float m_maxCharWidth; |
179 float m_avgCharWidth; | 176 float m_avgCharWidth; |
180 | 177 |
181 FontPlatformData m_platformData; | 178 FontPlatformData m_platformData; |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 | 250 |
254 m_glyphToWidthMap.setMetricsForGlyph(glyph, width); | 251 m_glyphToWidthMap.setMetricsForGlyph(glyph, width); |
255 return width; | 252 return width; |
256 #endif | 253 #endif |
257 } | 254 } |
258 | 255 |
259 DEFINE_FONT_DATA_TYPE_CASTS(SimpleFontData, false); | 256 DEFINE_FONT_DATA_TYPE_CASTS(SimpleFontData, false); |
260 | 257 |
261 } // namespace blink | 258 } // namespace blink |
262 #endif // SimpleFontData_h | 259 #endif // SimpleFontData_h |
OLD | NEW |