OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 | 83 |
84 if (runInfo.run.rtl()) { | 84 if (runInfo.run.rtl()) { |
85 initialAdvance = controller.totalWidth() - afterWidth; | 85 initialAdvance = controller.totalWidth() - afterWidth; |
86 glyphBuffer.reverse(); | 86 glyphBuffer.reverse(); |
87 } else | 87 } else |
88 initialAdvance = beforeWidth; | 88 initialAdvance = beforeWidth; |
89 | 89 |
90 return initialAdvance; | 90 return initialAdvance; |
91 } | 91 } |
92 | 92 |
93 void Font::drawComplexText(GraphicsContext* context, const TextRunPaintInfo& run
Info, const FloatPoint& point) const | 93 float Font::drawComplexText(GraphicsContext* context, const TextRunPaintInfo& ru
nInfo, const FloatPoint& point) const |
94 { | 94 { |
95 if (preferHarfBuzz(this)) { | 95 if (preferHarfBuzz(this)) { |
96 GlyphBuffer glyphBuffer; | 96 GlyphBuffer glyphBuffer; |
97 HarfBuzzShaper shaper(this, runInfo.run); | 97 HarfBuzzShaper shaper(this, runInfo.run); |
98 shaper.setDrawRange(runInfo.from, runInfo.to); | 98 shaper.setDrawRange(runInfo.from, runInfo.to); |
99 if (shaper.shape(&glyphBuffer)) { | 99 if (shaper.shape(&glyphBuffer)) { |
100 drawGlyphBuffer(context, runInfo, glyphBuffer, point); | 100 return drawGlyphBuffer(context, runInfo, glyphBuffer, point); |
101 return; | |
102 } | 101 } |
103 } | 102 } |
104 // This glyph buffer holds our glyphs + advances + font data for each glyph. | 103 // This glyph buffer holds our glyphs + advances + font data for each glyph. |
105 GlyphBuffer glyphBuffer; | 104 GlyphBuffer glyphBuffer; |
106 | 105 |
107 float startX = point.x() + getGlyphsAndAdvancesForComplexText(runInfo, glyph
Buffer); | 106 float startX = point.x() + getGlyphsAndAdvancesForComplexText(runInfo, glyph
Buffer); |
108 | 107 |
109 // We couldn't generate any glyphs for the run. Give up. | 108 // We couldn't generate any glyphs for the run. Give up. |
110 if (glyphBuffer.isEmpty()) | 109 if (glyphBuffer.isEmpty()) |
111 return; | 110 return 0; |
112 | 111 |
113 // Draw the glyph buffer now at the starting point returned in startX. | 112 // Draw the glyph buffer now at the starting point returned in startX. |
114 FloatPoint startPoint(startX, point.y()); | 113 FloatPoint startPoint(startX, point.y()); |
115 drawGlyphBuffer(context, runInfo, glyphBuffer, startPoint); | 114 return drawGlyphBuffer(context, runInfo, glyphBuffer, startPoint); |
116 } | 115 } |
117 | 116 |
118 void Font::drawEmphasisMarksForComplexText(GraphicsContext* context, const TextR
unPaintInfo& runInfo, const AtomicString& mark, const FloatPoint& point) const | 117 void Font::drawEmphasisMarksForComplexText(GraphicsContext* context, const TextR
unPaintInfo& runInfo, const AtomicString& mark, const FloatPoint& point) const |
119 { | 118 { |
120 GlyphBuffer glyphBuffer; | 119 GlyphBuffer glyphBuffer; |
121 float initialAdvance = getGlyphsAndAdvancesForComplexText(runInfo, glyphBuff
er, ForTextEmphasis); | 120 float initialAdvance = getGlyphsAndAdvancesForComplexText(runInfo, glyphBuff
er, ForTextEmphasis); |
122 | 121 |
123 if (glyphBuffer.isEmpty()) | 122 if (glyphBuffer.isEmpty()) |
124 return; | 123 return; |
125 | 124 |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 return simpleFontData; | 200 return simpleFontData; |
202 } | 201 } |
203 | 202 |
204 if (!triedBaseCharacterFontData && baseCharacterGlyphData.fontData && baseCh
aracterGlyphData.fontData->canRenderCombiningCharacterSequence(characters, lengt
h)) | 203 if (!triedBaseCharacterFontData && baseCharacterGlyphData.fontData && baseCh
aracterGlyphData.fontData->canRenderCombiningCharacterSequence(characters, lengt
h)) |
205 return baseCharacterGlyphData.fontData; | 204 return baseCharacterGlyphData.fontData; |
206 | 205 |
207 return SimpleFontData::systemFallback(); | 206 return SimpleFontData::systemFallback(); |
208 } | 207 } |
209 | 208 |
210 } // namespace blink | 209 } // namespace blink |
OLD | NEW |