OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) |
3 * (C) 2000 Antti Koivisto (koivisto@kde.org) | 3 * (C) 2000 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2000 Dirk Mueller (mueller@kde.org) | 4 * (C) 2000 Dirk Mueller (mueller@kde.org) |
5 * Copyright (C) 2003, 2006, 2007, 2010, 2011 Apple Inc. All rights reserved. | 5 * Copyright (C) 2003, 2006, 2007, 2010, 2011 Apple Inc. All rights reserved. |
6 * Copyright (C) 2008 Holger Hans Peter Freyther | 6 * Copyright (C) 2008 Holger Hans Peter Freyther |
7 * | 7 * |
8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 return glyphDataAndPageForCharacter(c, mirror, variant).first; | 128 return glyphDataAndPageForCharacter(c, mirror, variant).first; |
129 } | 129 } |
130 #if OS(MACOSX) | 130 #if OS(MACOSX) |
131 const SimpleFontData* fontDataForCombiningCharacterSequence(const UChar*, si
ze_t length, FontDataVariant) const; | 131 const SimpleFontData* fontDataForCombiningCharacterSequence(const UChar*, si
ze_t length, FontDataVariant) const; |
132 #endif | 132 #endif |
133 std::pair<GlyphData, GlyphPage*> glyphDataAndPageForCharacter(UChar32, bool
mirror, FontDataVariant = AutoVariant) const; | 133 std::pair<GlyphData, GlyphPage*> glyphDataAndPageForCharacter(UChar32, bool
mirror, FontDataVariant = AutoVariant) const; |
134 bool primaryFontHasGlyphForCharacter(UChar32) const; | 134 bool primaryFontHasGlyphForCharacter(UChar32) const; |
135 | 135 |
136 CodePath codePath(const TextRun&) const; | 136 CodePath codePath(const TextRun&) const; |
137 | 137 |
| 138 PassTextBlobPtr buildTextBlob(const TextRunPaintInfo&, const FloatPoint& tex
tOrigin, bool couldUseLCDRenderedText, CustomFontNotReadyAction = DoNotPaintIfFo
ntNotReady) const; |
| 139 void drawTextBlob(GraphicsContext*, const SkTextBlob*, const SkPoint& origin
) const; |
| 140 |
138 private: | 141 private: |
139 enum ForTextEmphasisOrNot { NotForTextEmphasis, ForTextEmphasis }; | 142 enum ForTextEmphasisOrNot { NotForTextEmphasis, ForTextEmphasis }; |
140 | 143 |
141 // Returns the initial in-stream advance. | 144 // Returns the initial in-stream advance. |
142 float getGlyphsAndAdvancesForSimpleText(const TextRunPaintInfo&, GlyphBuffer
&, ForTextEmphasisOrNot = NotForTextEmphasis) const; | 145 float getGlyphsAndAdvancesForSimpleText(const TextRunPaintInfo&, GlyphBuffer
&, ForTextEmphasisOrNot = NotForTextEmphasis) const; |
143 float drawSimpleText(GraphicsContext*, const TextRunPaintInfo&, const FloatP
oint&) const; | 146 float drawSimpleText(GraphicsContext*, const TextRunPaintInfo&, const FloatP
oint&) const; |
144 void drawEmphasisMarksForSimpleText(GraphicsContext*, const TextRunPaintInfo
&, const AtomicString& mark, const FloatPoint&) const; | 147 void drawEmphasisMarksForSimpleText(GraphicsContext*, const TextRunPaintInfo
&, const AtomicString& mark, const FloatPoint&) const; |
145 void drawGlyphs(GraphicsContext*, const SimpleFontData*, const GlyphBuffer&,
unsigned from, unsigned numGlyphs, const FloatPoint&, const FloatRect& textRect
) const; | 148 void drawGlyphs(GraphicsContext*, const SimpleFontData*, const GlyphBuffer&,
unsigned from, unsigned numGlyphs, const FloatPoint&, const FloatRect& textRect
) const; |
146 float drawGlyphBuffer(GraphicsContext*, const TextRunPaintInfo&, const Glyph
Buffer&, const FloatPoint&) const; | 149 float drawGlyphBuffer(GraphicsContext*, const TextRunPaintInfo&, const Glyph
Buffer&, const FloatPoint&) const; |
147 void drawTextBlob(GraphicsContext*, const SkTextBlob*, const SkPoint& origin
) const; | |
148 void drawEmphasisMarks(GraphicsContext*, const TextRunPaintInfo&, const Glyp
hBuffer&, const AtomicString&, const FloatPoint&) const; | 150 void drawEmphasisMarks(GraphicsContext*, const TextRunPaintInfo&, const Glyp
hBuffer&, const AtomicString&, const FloatPoint&) const; |
149 float floatWidthForSimpleText(const TextRun&, HashSet<const SimpleFontData*>
* fallbackFonts = 0, IntRectExtent* glyphBounds = 0) const; | 151 float floatWidthForSimpleText(const TextRun&, HashSet<const SimpleFontData*>
* fallbackFonts = 0, IntRectExtent* glyphBounds = 0) const; |
150 int offsetForPositionForSimpleText(const TextRun&, float position, bool incl
udePartialGlyphs) const; | 152 int offsetForPositionForSimpleText(const TextRun&, float position, bool incl
udePartialGlyphs) const; |
151 FloatRect selectionRectForSimpleText(const TextRun&, const FloatPoint&, int
h, int from, int to, bool accountForGlyphBounds) const; | 153 FloatRect selectionRectForSimpleText(const TextRun&, const FloatPoint&, int
h, int from, int to, bool accountForGlyphBounds) const; |
152 | 154 |
153 bool getEmphasisMarkGlyphData(const AtomicString&, GlyphData&) const; | 155 bool getEmphasisMarkGlyphData(const AtomicString&, GlyphData&) const; |
154 | 156 |
155 // Returns the initial in-stream advance. | 157 // Returns the initial in-stream advance. |
156 float getGlyphsAndAdvancesForComplexText(const TextRunPaintInfo&, GlyphBuffe
r&, ForTextEmphasisOrNot = NotForTextEmphasis) const; | 158 float getGlyphsAndAdvancesForComplexText(const TextRunPaintInfo&, GlyphBuffe
r&, ForTextEmphasisOrNot = NotForTextEmphasis) const; |
157 float drawComplexText(GraphicsContext*, const TextRunPaintInfo&, const Float
Point&) const; | 159 float drawComplexText(GraphicsContext*, const TextRunPaintInfo&, const Float
Point&) const; |
158 void drawEmphasisMarksForComplexText(GraphicsContext*, const TextRunPaintInf
o&, const AtomicString& mark, const FloatPoint&) const; | 160 void drawEmphasisMarksForComplexText(GraphicsContext*, const TextRunPaintInf
o&, const AtomicString& mark, const FloatPoint&) const; |
159 float floatWidthForComplexText(const TextRun&, HashSet<const SimpleFontData*
>* fallbackFonts, IntRectExtent* glyphBounds) const; | 161 float floatWidthForComplexText(const TextRun&, HashSet<const SimpleFontData*
>* fallbackFonts, IntRectExtent* glyphBounds) const; |
160 int offsetForPositionForComplexText(const TextRun&, float position, bool inc
ludePartialGlyphs) const; | 162 int offsetForPositionForComplexText(const TextRun&, float position, bool inc
ludePartialGlyphs) const; |
161 FloatRect selectionRectForComplexText(const TextRun&, const FloatPoint&, int
h, int from, int to) const; | 163 FloatRect selectionRectForComplexText(const TextRun&, const FloatPoint&, int
h, int from, int to) const; |
162 | 164 |
| 165 PassTextBlobPtr buildTextBlobForSimpleText(const TextRunPaintInfo&, const Fl
oatPoint& textOrigin, bool couldUseLCDRenderedText) const; |
| 166 PassTextBlobPtr buildTextBlob(const GlyphBuffer&, float initialAdvance, cons
t FloatRect& bounds, float& advance, bool couldUseLCD) const; |
| 167 |
163 friend struct WidthIterator; | 168 friend struct WidthIterator; |
164 friend class SVGTextRunRenderingContext; | 169 friend class SVGTextRunRenderingContext; |
165 | 170 |
166 public: | 171 public: |
167 // Useful for debugging the different font rendering code paths. | 172 // Useful for debugging the different font rendering code paths. |
168 static void setCodePath(CodePath); | 173 static void setCodePath(CodePath); |
169 static CodePath codePath(); | 174 static CodePath codePath(); |
170 static CodePath s_codePath; | 175 static CodePath s_codePath; |
171 | 176 |
172 FontSelector* fontSelector() const; | 177 FontSelector* fontSelector() const; |
173 | 178 |
174 FontFallbackList* fontList() const { return m_fontFallbackList.get(); } | 179 FontFallbackList* fontList() const { return m_fontFallbackList.get(); } |
175 | 180 |
176 void willUseFontData(UChar32) const; | 181 void willUseFontData(UChar32) const; |
177 | 182 |
178 static FloatRect pixelSnappedSelectionRect(float fromX, float toX, float y,
float height); | 183 static FloatRect pixelSnappedSelectionRect(float fromX, float toX, float y,
float height); |
179 private: | 184 private: |
180 bool loadingCustomFonts() const | 185 bool loadingCustomFonts() const |
181 { | 186 { |
182 return m_fontFallbackList && m_fontFallbackList->loadingCustomFonts(); | 187 return m_fontFallbackList && m_fontFallbackList->loadingCustomFonts(); |
183 } | 188 } |
184 | 189 |
185 bool shouldSkipDrawing() const | 190 bool shouldSkipDrawing() const |
186 { | 191 { |
187 return m_fontFallbackList && m_fontFallbackList->shouldSkipDrawing(); | 192 return m_fontFallbackList && m_fontFallbackList->shouldSkipDrawing(); |
188 } | 193 } |
189 | 194 |
190 PassTextBlobPtr buildTextBlob(const GlyphBuffer&, float initialAdvance, cons
t FloatRect& bounds, | |
191 float& advance, bool couldUseLCD) const; | |
192 | |
193 FontDescription m_fontDescription; | 195 FontDescription m_fontDescription; |
194 mutable RefPtr<FontFallbackList> m_fontFallbackList; | 196 mutable RefPtr<FontFallbackList> m_fontFallbackList; |
195 }; | 197 }; |
196 | 198 |
197 inline Font::~Font() | 199 inline Font::~Font() |
198 { | 200 { |
199 } | 201 } |
200 | 202 |
201 inline const SimpleFontData* Font::primaryFont() const | 203 inline const SimpleFontData* Font::primaryFont() const |
202 { | 204 { |
(...skipping 22 matching lines...) Expand all Loading... |
225 { | 227 { |
226 if (!tabSize) | 228 if (!tabSize) |
227 return fontDescription().letterSpacing(); | 229 return fontDescription().letterSpacing(); |
228 float tabWidth = tabSize * fontData.spaceWidth() + fontDescription().letterS
pacing(); | 230 float tabWidth = tabSize * fontData.spaceWidth() + fontDescription().letterS
pacing(); |
229 return tabWidth - fmodf(position, tabWidth); | 231 return tabWidth - fmodf(position, tabWidth); |
230 } | 232 } |
231 | 233 |
232 } // namespace blink | 234 } // namespace blink |
233 | 235 |
234 #endif | 236 #endif |
OLD | NEW |