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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 , m_inPathLayout(false) | 49 , m_inPathLayout(false) |
50 , m_textPathCalculator(0) | 50 , m_textPathCalculator(0) |
51 , m_textPathLength(0) | 51 , m_textPathLength(0) |
52 , m_textPathCurrentOffset(0) | 52 , m_textPathCurrentOffset(0) |
53 , m_textPathSpacing(0) | 53 , m_textPathSpacing(0) |
54 , m_textPathScaling(1) | 54 , m_textPathScaling(1) |
55 { | 55 { |
56 ASSERT(!m_layoutAttributes.isEmpty()); | 56 ASSERT(!m_layoutAttributes.isEmpty()); |
57 } | 57 } |
58 | 58 |
59 void SVGTextLayoutEngine::updateCharacerPositionIfNeeded(float& x, float& y) | 59 void SVGTextLayoutEngine::updateCharacterPositionIfNeeded(float& x, float& y) |
60 { | 60 { |
61 if (m_inPathLayout) | 61 if (m_inPathLayout) |
62 return; | 62 return; |
63 | 63 |
64 // Replace characters x/y position, with the current text position plus any | 64 // Replace characters x/y position, with the current text position plus any |
65 // relative adjustments, if it doesn't specify an absolute position itself. | 65 // relative adjustments, if it doesn't specify an absolute position itself. |
66 if (x == SVGTextLayoutAttributes::emptyValue()) | 66 if (x == SVGTextLayoutAttributes::emptyValue()) |
67 x = m_x + m_dx; | 67 x = m_x + m_dx; |
68 | 68 |
69 if (y == SVGTextLayoutAttributes::emptyValue()) | 69 if (y == SVGTextLayoutAttributes::emptyValue()) |
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
495 // Calculate glyph orientation angle. | 495 // Calculate glyph orientation angle. |
496 UChar currentCharacter = text->characterAt(m_visualCharacterOffset); | 496 UChar currentCharacter = text->characterAt(m_visualCharacterOffset); |
497 float orientationAngle = baselineLayout.calculateGlyphOrientationAngle(m
_isVerticalText, svgStyle, currentCharacter); | 497 float orientationAngle = baselineLayout.calculateGlyphOrientationAngle(m
_isVerticalText, svgStyle, currentCharacter); |
498 | 498 |
499 // Calculate glyph advance & x/y orientation shifts. | 499 // Calculate glyph advance & x/y orientation shifts. |
500 float xOrientationShift = 0; | 500 float xOrientationShift = 0; |
501 float yOrientationShift = 0; | 501 float yOrientationShift = 0; |
502 float glyphAdvance = baselineLayout.calculateGlyphAdvanceAndOrientation(
m_isVerticalText, visualMetrics, orientationAngle, xOrientationShift, yOrientati
onShift); | 502 float glyphAdvance = baselineLayout.calculateGlyphAdvanceAndOrientation(
m_isVerticalText, visualMetrics, orientationAngle, xOrientationShift, yOrientati
onShift); |
503 | 503 |
504 // Assign current text position to x/y values, if needed. | 504 // Assign current text position to x/y values, if needed. |
505 updateCharacerPositionIfNeeded(x, y); | 505 updateCharacterPositionIfNeeded(x, y); |
506 | 506 |
507 // Apply dx/dy value adjustments to current text position, if needed. | 507 // Apply dx/dy value adjustments to current text position, if needed. |
508 updateRelativePositionAdjustmentsIfNeeded(data.dx, data.dy); | 508 updateRelativePositionAdjustmentsIfNeeded(data.dx, data.dy); |
509 | 509 |
510 // Calculate SVG Fonts kerning, if needed. | 510 // Calculate SVG Fonts kerning, if needed. |
511 float kerning = spacingLayout.calculateSVGKerning(m_isVerticalText, visu
alMetrics.glyph()); | 511 float kerning = spacingLayout.calculateSVGKerning(m_isVerticalText, visu
alMetrics.glyph()); |
512 | 512 |
513 // Calculate CSS 'letter-spacing' and 'word-spacing' for next character,
if needed. | 513 // Calculate CSS 'letter-spacing' and 'word-spacing' for next character,
if needed. |
514 float spacing = spacingLayout.calculateCSSSpacing(currentCharacter); | 514 float spacing = spacingLayout.calculateCSSSpacing(currentCharacter); |
515 | 515 |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
645 } | 645 } |
646 | 646 |
647 if (!didStartTextFragment) | 647 if (!didStartTextFragment) |
648 return; | 648 return; |
649 | 649 |
650 // Close last open fragment, if needed. | 650 // Close last open fragment, if needed. |
651 recordTextFragment(textBox, visualMetricsValues); | 651 recordTextFragment(textBox, visualMetricsValues); |
652 } | 652 } |
653 | 653 |
654 } | 654 } |
OLD | NEW |