OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2009, 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2009, 2011 Apple Inc. All rights reserved. |
3 * Copyright (C) 2007-2008 Torch Mobile Inc. | 3 * Copyright (C) 2007-2008 Torch Mobile Inc. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * | 8 * |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 const GlyphBufferGlyph* glyphs(unsigned from) const { return m_glyphs.data()
+ from; } | 79 const GlyphBufferGlyph* glyphs(unsigned from) const { return m_glyphs.data()
+ from; } |
80 const GlyphBufferAdvance* advances(unsigned from) const { return m_advances.
data() + from; } | 80 const GlyphBufferAdvance* advances(unsigned from) const { return m_advances.
data() + from; } |
81 | 81 |
82 const SimpleFontData* fontDataAt(unsigned index) const { return m_fontData[i
ndex]; } | 82 const SimpleFontData* fontDataAt(unsigned index) const { return m_fontData[i
ndex]; } |
83 | 83 |
84 Glyph glyphAt(unsigned index) const | 84 Glyph glyphAt(unsigned index) const |
85 { | 85 { |
86 return m_glyphs[index]; | 86 return m_glyphs[index]; |
87 } | 87 } |
88 | 88 |
89 float advanceAt(unsigned index) const | 89 FloatSize advanceAt(unsigned index) const |
90 { | 90 { |
91 return m_advances[index].width(); | 91 #if OS(MACOSX) |
| 92 return FloatSize(m_advances[index]); |
| 93 #else |
| 94 return m_advances[index]; |
| 95 #endif |
92 } | 96 } |
93 | 97 |
94 void add(Glyph glyph, const SimpleFontData* font, float width) | 98 void add(Glyph glyph, const SimpleFontData* font, float width) |
95 { | 99 { |
96 m_fontData.append(font); | 100 m_fontData.append(font); |
97 m_glyphs.append(glyph); | 101 m_glyphs.append(glyph); |
98 | 102 |
99 #if OS(MACOSX) | 103 #if OS(MACOSX) |
100 CGSize advance = { width, 0 }; | 104 CGSize advance = { width, 0 }; |
101 m_advances.append(advance); | 105 m_advances.append(advance); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 m_advances[index2] = s; | 144 m_advances[index2] = s; |
141 } | 145 } |
142 | 146 |
143 Vector<const SimpleFontData*, 2048> m_fontData; | 147 Vector<const SimpleFontData*, 2048> m_fontData; |
144 Vector<GlyphBufferGlyph, 2048> m_glyphs; | 148 Vector<GlyphBufferGlyph, 2048> m_glyphs; |
145 Vector<GlyphBufferAdvance, 2048> m_advances; | 149 Vector<GlyphBufferAdvance, 2048> m_advances; |
146 }; | 150 }; |
147 | 151 |
148 } | 152 } |
149 #endif | 153 #endif |
OLD | NEW |