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 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
434 | 434 |
435 const SVGRenderStyle* svgStyle = style->svgStyle(); | 435 const SVGRenderStyle* svgStyle = style->svgStyle(); |
436 ASSERT(svgStyle); | 436 ASSERT(svgStyle); |
437 | 437 |
438 m_visualMetricsListOffset = 0; | 438 m_visualMetricsListOffset = 0; |
439 m_visualCharacterOffset = 0; | 439 m_visualCharacterOffset = 0; |
440 | 440 |
441 Vector<SVGTextMetrics>& visualMetricsValues = text->layoutAttributes()->text
MetricsValues(); | 441 Vector<SVGTextMetrics>& visualMetricsValues = text->layoutAttributes()->text
MetricsValues(); |
442 ASSERT(!visualMetricsValues.isEmpty()); | 442 ASSERT(!visualMetricsValues.isEmpty()); |
443 | 443 |
444 const UChar* characters = text->bloatedCharacters(); | |
445 const Font& font = style->font(); | 444 const Font& font = style->font(); |
446 | 445 |
447 SVGTextLayoutEngineSpacing spacingLayout(font); | 446 SVGTextLayoutEngineSpacing spacingLayout(font); |
448 SVGTextLayoutEngineBaseline baselineLayout(font); | 447 SVGTextLayoutEngineBaseline baselineLayout(font); |
449 | 448 |
450 bool didStartTextFragment = false; | 449 bool didStartTextFragment = false; |
451 bool applySpacingToNextCharacter = false; | 450 bool applySpacingToNextCharacter = false; |
452 | 451 |
453 float lastAngle = 0; | 452 float lastAngle = 0; |
454 float baselineShift = baselineLayout.calculateBaselineShift(svgStyle, length
Context); | 453 float baselineShift = baselineLayout.calculateBaselineShift(svgStyle, length
Context); |
(...skipping 30 matching lines...) Expand all Loading... |
485 float y = data.y; | 484 float y = data.y; |
486 | 485 |
487 // When we've advanced to the box start offset, determine using the orig
inal x/y values, | 486 // When we've advanced to the box start offset, determine using the orig
inal x/y values, |
488 // whether this character starts a new text chunk, before doing any furt
her processing. | 487 // whether this character starts a new text chunk, before doing any furt
her processing. |
489 if (m_visualCharacterOffset == textBox->start()) | 488 if (m_visualCharacterOffset == textBox->start()) |
490 textBox->setStartsNewTextChunk(logicalAttributes->context()->charact
erStartsNewTextChunk(m_logicalCharacterOffset)); | 489 textBox->setStartsNewTextChunk(logicalAttributes->context()->charact
erStartsNewTextChunk(m_logicalCharacterOffset)); |
491 | 490 |
492 float angle = data.rotate == SVGTextLayoutAttributes::emptyValue() ? 0 :
data.rotate; | 491 float angle = data.rotate == SVGTextLayoutAttributes::emptyValue() ? 0 :
data.rotate; |
493 | 492 |
494 // Calculate glyph orientation angle. | 493 // Calculate glyph orientation angle. |
495 const UChar* currentCharacter = characters + m_visualCharacterOffset; | 494 UChar currentCharacter = text->characterAt(m_visualCharacterOffset); |
496 float orientationAngle = baselineLayout.calculateGlyphOrientationAngle(m
_isVerticalText, svgStyle, *currentCharacter); | 495 float orientationAngle = baselineLayout.calculateGlyphOrientationAngle(m
_isVerticalText, svgStyle, currentCharacter); |
497 | 496 |
498 // Calculate glyph advance & x/y orientation shifts. | 497 // Calculate glyph advance & x/y orientation shifts. |
499 float xOrientationShift = 0; | 498 float xOrientationShift = 0; |
500 float yOrientationShift = 0; | 499 float yOrientationShift = 0; |
501 float glyphAdvance = baselineLayout.calculateGlyphAdvanceAndOrientation(
m_isVerticalText, visualMetrics, orientationAngle, xOrientationShift, yOrientati
onShift); | 500 float glyphAdvance = baselineLayout.calculateGlyphAdvanceAndOrientation(
m_isVerticalText, visualMetrics, orientationAngle, xOrientationShift, yOrientati
onShift); |
502 | 501 |
503 // Assign current text position to x/y values, if needed. | 502 // Assign current text position to x/y values, if needed. |
504 updateCharacerPositionIfNeeded(x, y); | 503 updateCharacerPositionIfNeeded(x, y); |
505 | 504 |
506 // Apply dx/dy value adjustments to current text position, if needed. | 505 // Apply dx/dy value adjustments to current text position, if needed. |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
647 } | 646 } |
648 | 647 |
649 if (!didStartTextFragment) | 648 if (!didStartTextFragment) |
650 return; | 649 return; |
651 | 650 |
652 // Close last open fragment, if needed. | 651 // Close last open fragment, if needed. |
653 recordTextFragment(textBox, visualMetricsValues); | 652 recordTextFragment(textBox, visualMetricsValues); |
654 } | 653 } |
655 | 654 |
656 } | 655 } |
OLD | NEW |