Index: third_party/WebKit/Source/core/layout/svg/SVGTextLayoutEngine.cpp |
diff --git a/third_party/WebKit/Source/core/layout/svg/SVGTextLayoutEngine.cpp b/third_party/WebKit/Source/core/layout/svg/SVGTextLayoutEngine.cpp |
index 3822998668a128b6ae09dca2fbfea70c030b3ddc..209e6bc3e03f2d94f6985fa6bf496cc32ad6c6d6 100644 |
--- a/third_party/WebKit/Source/core/layout/svg/SVGTextLayoutEngine.cpp |
+++ b/third_party/WebKit/Source/core/layout/svg/SVGTextLayoutEngine.cpp |
@@ -334,8 +334,6 @@ void SVGTextLayoutEngine::layoutTextOnLineOrPath(SVGInlineTextBox* textBox, cons |
if (m_inPathLayout && !m_textPathCalculator) |
return; |
- const SVGComputedStyle& svgStyle = style.svgStyle(); |
- |
// Find the start of the current text box in the metrics list. |
m_visualMetricsIterator.advanceToTextStart(&text, textBox->start()); |
@@ -386,13 +384,17 @@ void SVGTextLayoutEngine::layoutTextOnLineOrPath(SVGInlineTextBox* textBox, cons |
float angle = SVGTextLayoutAttributes::isEmptyValue(data.rotate) ? 0 : data.rotate; |
// Calculate glyph orientation angle. |
+ // Font::width() calculates the resolved FontOrientation for each character, |
+ // but does not expose today to avoid the API becomes too complex. |
fs
2015/10/16 10:54:50
Nit: "but does not expose today" -> "but is not ex
|
UChar32 currentCharacter = text.codepointAt(m_visualMetricsIterator.characterOffset()); |
- float orientationAngle = baselineLayout.calculateGlyphOrientationAngle(m_isVerticalText, svgStyle, currentCharacter); |
+ FontOrientation fontOrientation = font.fontDescription().orientation(); |
+ fontOrientation = resolveMixedFontOrientation(fontOrientation, currentCharacter); |
- // Calculate glyph advance & x/y orientation shifts. |
+ // Calculate glyph advance. |
+ // Shaping engine takes care of x/y orientation shifts for different fontOrientation values. |
float xOrientationShift = 0; |
float yOrientationShift = 0; |
fs
2015/10/16 10:54:50
These two are now only used for <textPath> related
|
- float glyphAdvance = baselineLayout.calculateGlyphAdvanceAndOrientation(m_isVerticalText, visualMetrics, orientationAngle, xOrientationShift, yOrientationShift); |
+ float glyphAdvance = visualMetrics.advance(fontOrientation); |
// Assign current text position to x/y values, if needed. |
updateCharacterPositionIfNeeded(x, y); |
@@ -469,7 +471,7 @@ void SVGTextLayoutEngine::layoutTextOnLineOrPath(SVGInlineTextBox* textBox, cons |
// Determine whether we have to start a new fragment. |
bool shouldStartNewFragment = m_dx || m_dy || m_isVerticalText || m_inPathLayout || angle || angle != lastAngle |
- || orientationAngle || applySpacingToNextCharacter || m_textLengthSpacingInEffect; |
+ || applySpacingToNextCharacter || m_textLengthSpacingInEffect; |
// If we already started a fragment, close it now. |
if (didStartTextFragment && shouldStartNewFragment) { |
@@ -495,8 +497,10 @@ void SVGTextLayoutEngine::layoutTextOnLineOrPath(SVGInlineTextBox* textBox, cons |
if (xOrientationShift || yOrientationShift) |
m_currentTextFragment.transform.translate(xOrientationShift, yOrientationShift); |
- if (orientationAngle) |
- m_currentTextFragment.transform.rotate(orientationAngle); |
+ // In vertical text, always rotate by 90 degrees regardless of fontOrientation. |
+ // Shaping engine takes care of the necessary orientation. |
+ if (m_isVerticalText) |
+ m_currentTextFragment.transform.rotate(90); |
m_currentTextFragment.isTextOnPath = m_inPathLayout && m_textPathScaling != 1; |
if (m_currentTextFragment.isTextOnPath) { |