Chromium Code Reviews| 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 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 updateCharacerPositionIfNeeded(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()); |
|
pdr.
2014/04/11 00:25:21
SVG Fonts still support a kerning element. This wi
| |
| 512 | 512 |
| 513 // Calculate CSS 'kerning', '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.calculateCSSKerningAndSpacing(svgStyle, le ngthContext, currentCharacter); | 514 float spacing = spacingLayout.calculateCSSSpacing(currentCharacter); |
| 515 | 515 |
| 516 float textPathOffset = 0; | 516 float textPathOffset = 0; |
| 517 if (m_inPathLayout) { | 517 if (m_inPathLayout) { |
| 518 float scaledGlyphAdvance = glyphAdvance * m_textPathScaling; | 518 float scaledGlyphAdvance = glyphAdvance * m_textPathScaling; |
| 519 if (m_isVerticalText) { | 519 if (m_isVerticalText) { |
| 520 // If there's an absolute y position available, it marks the beg inning of a new position along the path. | 520 // If there's an absolute y position available, it marks the beg inning of a new position along the path. |
| 521 if (y != SVGTextLayoutAttributes::emptyValue()) | 521 if (y != SVGTextLayoutAttributes::emptyValue()) |
| 522 m_textPathCurrentOffset = y + m_textPathStartOffset; | 522 m_textPathCurrentOffset = y + m_textPathStartOffset; |
| 523 | 523 |
| 524 m_textPathCurrentOffset += m_dy - kerning; | 524 m_textPathCurrentOffset += m_dy - kerning; |
| (...skipping 120 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 |