| 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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 SVGTextMetrics SVGTextMetricsCalculator::computeMetricsForCharacterSimple(unsign
ed textPosition) | 116 SVGTextMetrics SVGTextMetricsCalculator::computeMetricsForCharacterSimple(unsign
ed textPosition) |
| 117 { | 117 { |
| 118 GlyphBuffer glyphBuffer; | 118 GlyphBuffer glyphBuffer; |
| 119 unsigned metricsLength = m_simpleShaper->advance(textPosition + 1, &glyphBuf
fer); | 119 unsigned metricsLength = m_simpleShaper->advance(textPosition + 1, &glyphBuf
fer); |
| 120 if (!metricsLength) | 120 if (!metricsLength) |
| 121 return SVGTextMetrics(); | 121 return SVGTextMetrics(); |
| 122 | 122 |
| 123 float currentWidth = m_simpleShaper->runWidthSoFar() - m_totalWidth; | 123 float currentWidth = m_simpleShaper->runWidthSoFar() - m_totalWidth; |
| 124 m_totalWidth = m_simpleShaper->runWidthSoFar(); | 124 m_totalWidth = m_simpleShaper->runWidthSoFar(); |
| 125 | 125 |
| 126 return SVGTextMetrics(m_text, textPosition, metricsLength, currentWidth); | 126 return SVGTextMetrics(m_text, metricsLength, currentWidth); |
| 127 } | 127 } |
| 128 | 128 |
| 129 SVGTextMetrics SVGTextMetricsCalculator::computeMetricsForCharacterComplex(unsig
ned textPosition) | 129 SVGTextMetrics SVGTextMetricsCalculator::computeMetricsForCharacterComplex(unsig
ned textPosition) |
| 130 { | 130 { |
| 131 unsigned metricsLength = characterStartsSurrogatePair(textPosition) ? 2 : 1; | 131 unsigned metricsLength = characterStartsSurrogatePair(textPosition) ? 2 : 1; |
| 132 SVGTextMetrics metrics = SVGTextMetrics::measureCharacterRange(m_text, textP
osition, metricsLength, m_textDirection); | 132 SVGTextMetrics metrics = SVGTextMetrics::measureCharacterRange(m_text, textP
osition, metricsLength, m_textDirection); |
| 133 ASSERT(metrics.length() == metricsLength); | 133 ASSERT(metrics.length() == metricsLength); |
| 134 | 134 |
| 135 unsigned startPosition = m_bidiRun ? m_bidiRun->start() : 0; | 135 unsigned startPosition = m_bidiRun ? m_bidiRun->start() : 0; |
| 136 ASSERT(startPosition <= textPosition); | 136 ASSERT(startPosition <= textPosition); |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 } | 268 } |
| 269 | 269 |
| 270 void SVGTextMetricsBuilder::buildMetricsAndLayoutAttributes(LayoutSVGText* textR
oot, LayoutSVGInlineText* stopAtLeaf, SVGCharacterDataMap& allCharactersMap) | 270 void SVGTextMetricsBuilder::buildMetricsAndLayoutAttributes(LayoutSVGText* textR
oot, LayoutSVGInlineText* stopAtLeaf, SVGCharacterDataMap& allCharactersMap) |
| 271 { | 271 { |
| 272 ASSERT(textRoot); | 272 ASSERT(textRoot); |
| 273 MeasureTextData data(&allCharactersMap); | 273 MeasureTextData data(&allCharactersMap); |
| 274 walkTree(textRoot, stopAtLeaf, &data); | 274 walkTree(textRoot, stopAtLeaf, &data); |
| 275 } | 275 } |
| 276 | 276 |
| 277 } | 277 } |
| OLD | NEW |