OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) Research In Motion Limited 2010-2012. All rights reserved. | 2 * Copyright (C) Research In Motion Limited 2010-2012. All rights reserved. |
3 * | 3 * |
4 * This library is free software; you can redistribute it and/or | 4 * This library is free software; you can redistribute it and/or |
5 * modify it under the terms of the GNU Library General Public | 5 * modify it under the terms of the GNU Library General Public |
6 * License as published by the Free Software Foundation; either | 6 * License as published by the Free Software Foundation; either |
7 * version 2 of the License, or (at your option) any later version. | 7 * version 2 of the License, or (at your option) any later version. |
8 * | 8 * |
9 * This library is distributed in the hope that it will be useful, | 9 * This library is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 SVGTextMetrics SVGTextMetricsCalculator::computeMetricsForCharacterSimple(unsign
ed textPosition) | 117 SVGTextMetrics SVGTextMetricsCalculator::computeMetricsForCharacterSimple(unsign
ed textPosition) |
118 { | 118 { |
119 GlyphBuffer glyphBuffer; | 119 GlyphBuffer glyphBuffer; |
120 unsigned metricsLength = m_simpleShaper->advance(textPosition + 1, &glyphBuf
fer); | 120 unsigned metricsLength = m_simpleShaper->advance(textPosition + 1, &glyphBuf
fer); |
121 if (!metricsLength) | 121 if (!metricsLength) |
122 return SVGTextMetrics(); | 122 return SVGTextMetrics(); |
123 | 123 |
124 float currentWidth = m_simpleShaper->runWidthSoFar() - m_totalWidth; | 124 float currentWidth = m_simpleShaper->runWidthSoFar() - m_totalWidth; |
125 m_totalWidth = m_simpleShaper->runWidthSoFar(); | 125 m_totalWidth = m_simpleShaper->runWidthSoFar(); |
126 | 126 |
127 Glyph glyphId = glyphBuffer.glyphAt(0); | 127 return SVGTextMetrics(m_text, textPosition, metricsLength, currentWidth); |
128 return SVGTextMetrics(m_text, textPosition, metricsLength, currentWidth, gly
phId); | |
129 } | 128 } |
130 | 129 |
131 SVGTextMetrics SVGTextMetricsCalculator::computeMetricsForCharacterComplex(unsig
ned textPosition) | 130 SVGTextMetrics SVGTextMetricsCalculator::computeMetricsForCharacterComplex(unsig
ned textPosition) |
132 { | 131 { |
133 unsigned metricsLength = characterStartsSurrogatePair(textPosition) ? 2 : 1; | 132 unsigned metricsLength = characterStartsSurrogatePair(textPosition) ? 2 : 1; |
134 SVGTextMetrics metrics = SVGTextMetrics::measureCharacterRange(m_text, textP
osition, metricsLength, m_textDirection); | 133 SVGTextMetrics metrics = SVGTextMetrics::measureCharacterRange(m_text, textP
osition, metricsLength, m_textDirection); |
135 ASSERT(metrics.length() == metricsLength); | 134 ASSERT(metrics.length() == metricsLength); |
136 | 135 |
137 unsigned startPosition = m_bidiRun ? m_bidiRun->start() : 0; | 136 unsigned startPosition = m_bidiRun ? m_bidiRun->start() : 0; |
138 ASSERT(startPosition <= textPosition); | 137 ASSERT(startPosition <= textPosition); |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 } | 269 } |
271 | 270 |
272 void SVGTextMetricsBuilder::buildMetricsAndLayoutAttributes(RenderSVGText* textR
oot, RenderSVGInlineText* stopAtLeaf, SVGCharacterDataMap& allCharactersMap) | 271 void SVGTextMetricsBuilder::buildMetricsAndLayoutAttributes(RenderSVGText* textR
oot, RenderSVGInlineText* stopAtLeaf, SVGCharacterDataMap& allCharactersMap) |
273 { | 272 { |
274 ASSERT(textRoot); | 273 ASSERT(textRoot); |
275 MeasureTextData data(&allCharactersMap); | 274 MeasureTextData data(&allCharactersMap); |
276 walkTree(textRoot, stopAtLeaf, &data); | 275 walkTree(textRoot, stopAtLeaf, &data); |
277 } | 276 } |
278 | 277 |
279 } | 278 } |
OLD | NEW |