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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 #if OS(DARWIN) && PLATFORM(CHROMIUM) | 42 #if OS(DARWIN) && PLATFORM(CHROMIUM) |
43 #include <ApplicationServices/ApplicationServices.h> | 43 #include <ApplicationServices/ApplicationServices.h> |
44 #endif | 44 #endif |
45 | 45 |
46 namespace WebCore { | 46 namespace WebCore { |
47 | 47 |
48 class SimpleFontData; | 48 class SimpleFontData; |
49 | 49 |
50 #if OS(WINCE) | 50 #if OS(WINCE) |
51 typedef wchar_t GlyphBufferGlyph; | 51 typedef wchar_t GlyphBufferGlyph; |
52 #elif PLATFORM(QT) | |
53 typedef quint32 GlyphBufferGlyph; | |
54 #else | 52 #else |
55 typedef Glyph GlyphBufferGlyph; | 53 typedef Glyph GlyphBufferGlyph; |
56 #endif | 54 #endif |
57 | 55 |
58 // CG uses CGSize instead of FloatSize so that the result of advances() | 56 // CG uses CGSize instead of FloatSize so that the result of advances() |
59 // can be passed directly to CGContextShowGlyphsWithAdvances in FontMac.mm | 57 // can be passed directly to CGContextShowGlyphsWithAdvances in FontMac.mm |
60 #if USE(CG) || (OS(DARWIN) && PLATFORM(CHROMIUM)) | 58 #if USE(CG) || (OS(DARWIN) && PLATFORM(CHROMIUM)) |
61 struct GlyphBufferAdvance : CGSize { | 59 struct GlyphBufferAdvance : CGSize { |
62 public: | 60 public: |
63 GlyphBufferAdvance(CGSize size) : CGSize(size) | 61 GlyphBufferAdvance(CGSize size) : CGSize(size) |
(...skipping 13 matching lines...) Expand all Loading... |
77 : advance(width) | 75 : advance(width) |
78 { | 76 { |
79 } | 77 } |
80 | 78 |
81 void setWidth(float width) { advance = width; } | 79 void setWidth(float width) { advance = width; } |
82 float width() const { return advance; } | 80 float width() const { return advance; } |
83 | 81 |
84 private: | 82 private: |
85 float advance; | 83 float advance; |
86 }; | 84 }; |
87 #elif PLATFORM(QT) | |
88 struct GlyphBufferAdvance : public QPointF { | |
89 public: | |
90 GlyphBufferAdvance(const QPointF& advance) | |
91 : QPointF(advance) | |
92 { | |
93 } | |
94 | |
95 void setWidth(qreal width) { QPointF::setX(width); } | |
96 qreal width() const { return QPointF::x(); } | |
97 qreal height() const { return QPointF::y(); } | |
98 }; | |
99 #else | 85 #else |
100 typedef FloatSize GlyphBufferAdvance; | 86 typedef FloatSize GlyphBufferAdvance; |
101 #endif | 87 #endif |
102 | 88 |
103 class GlyphBuffer { | 89 class GlyphBuffer { |
104 public: | 90 public: |
105 bool isEmpty() const { return m_fontData.isEmpty(); } | 91 bool isEmpty() const { return m_fontData.isEmpty(); } |
106 int size() const { return m_fontData.size(); } | 92 int size() const { return m_fontData.size(); } |
107 | 93 |
108 void clear() | 94 void clear() |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 void add(Glyph glyph, const SimpleFontData* font, float width, const FloatSi
ze* offset = 0) | 131 void add(Glyph glyph, const SimpleFontData* font, float width, const FloatSi
ze* offset = 0) |
146 { | 132 { |
147 m_fontData.append(font); | 133 m_fontData.append(font); |
148 m_glyphs.append(glyph); | 134 m_glyphs.append(glyph); |
149 | 135 |
150 #if USE(CG) || (OS(DARWIN) && PLATFORM(CHROMIUM)) | 136 #if USE(CG) || (OS(DARWIN) && PLATFORM(CHROMIUM)) |
151 CGSize advance = { width, 0 }; | 137 CGSize advance = { width, 0 }; |
152 m_advances.append(advance); | 138 m_advances.append(advance); |
153 #elif OS(WINCE) | 139 #elif OS(WINCE) |
154 m_advances.append(width); | 140 m_advances.append(width); |
155 #elif PLATFORM(QT) | |
156 m_advances.append(QPointF(width, 0)); | |
157 #else | 141 #else |
158 m_advances.append(FloatSize(width, 0)); | 142 m_advances.append(FloatSize(width, 0)); |
159 #endif | 143 #endif |
160 | 144 |
161 #if PLATFORM(WIN) | 145 #if PLATFORM(WIN) |
162 if (offset) | 146 if (offset) |
163 m_offsets.append(*offset); | 147 m_offsets.append(*offset); |
164 else | 148 else |
165 m_offsets.append(FloatSize()); | 149 m_offsets.append(FloatSize()); |
166 #else | 150 #else |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 Vector<const SimpleFontData*, 2048> m_fontData; | 199 Vector<const SimpleFontData*, 2048> m_fontData; |
216 Vector<GlyphBufferGlyph, 2048> m_glyphs; | 200 Vector<GlyphBufferGlyph, 2048> m_glyphs; |
217 Vector<GlyphBufferAdvance, 2048> m_advances; | 201 Vector<GlyphBufferAdvance, 2048> m_advances; |
218 #if PLATFORM(WIN) | 202 #if PLATFORM(WIN) |
219 Vector<FloatSize, 2048> m_offsets; | 203 Vector<FloatSize, 2048> m_offsets; |
220 #endif | 204 #endif |
221 }; | 205 }; |
222 | 206 |
223 } | 207 } |
224 #endif | 208 #endif |
OLD | NEW |