mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-01 00:32:11 +00:00
Bug 1621502 - fix lengthAdjust when applied to vertical text r=jfkthame
Differential Revision: https://phabricator.services.mozilla.com/D199797
This commit is contained in:
parent
3903defcbd
commit
6dcb1f869d
@ -718,16 +718,16 @@ gfxMatrix TextRenderedRun::GetTransformFromUserSpaceForPainting(
|
||||
// Rotation due to rotate="" or a <textPath>.
|
||||
m.PreRotate(mRotate);
|
||||
|
||||
m.PreScale(mLengthAdjustScaleFactor, 1.0);
|
||||
|
||||
// Translation to get the text frame in the right place.
|
||||
// Scale for textLength="" and translate to get the text frame
|
||||
// to the right place.
|
||||
nsPoint t;
|
||||
|
||||
if (IsVertical()) {
|
||||
m.PreScale(1.0, mLengthAdjustScaleFactor);
|
||||
t = nsPoint(-mBaseline, IsRightToLeft()
|
||||
? -mFrame->GetRect().height + aVisIEndEdge
|
||||
: -aVisIStartEdge);
|
||||
} else {
|
||||
m.PreScale(mLengthAdjustScaleFactor, 1.0);
|
||||
t = nsPoint(IsRightToLeft() ? -mFrame->GetRect().width + aVisIEndEdge
|
||||
: -aVisIStartEdge,
|
||||
-mBaseline);
|
||||
@ -756,15 +756,16 @@ gfxMatrix TextRenderedRun::GetTransformFromRunUserSpaceToUserSpace(
|
||||
// Rotation due to rotate="" or a <textPath>.
|
||||
m.PreRotate(mRotate);
|
||||
|
||||
// Scale due to textLength="".
|
||||
m.PreScale(mLengthAdjustScaleFactor, 1.0);
|
||||
// Scale for textLength="" and translate to get the text frame
|
||||
// to the right place.
|
||||
|
||||
// Translation to get the text frame in the right place.
|
||||
nsPoint t;
|
||||
if (IsVertical()) {
|
||||
m.PreScale(1.0, mLengthAdjustScaleFactor);
|
||||
t = nsPoint(-mBaseline,
|
||||
IsRightToLeft() ? -mFrame->GetRect().height + start + end : 0);
|
||||
} else {
|
||||
m.PreScale(mLengthAdjustScaleFactor, 1.0);
|
||||
t = nsPoint(IsRightToLeft() ? -mFrame->GetRect().width + start + end : 0,
|
||||
-mBaseline);
|
||||
}
|
||||
@ -869,6 +870,12 @@ SVGBBox TextRenderedRun::GetRunUserSpaceRect(nsPresContext* aContext,
|
||||
fillInAppUnits.height),
|
||||
aContext);
|
||||
|
||||
if (vertical) {
|
||||
fill.Scale(1.0, mLengthAdjustScaleFactor);
|
||||
} else {
|
||||
fill.Scale(mLengthAdjustScaleFactor, 1.0);
|
||||
}
|
||||
|
||||
// Scale the rectangle up due to any mFontSizeScaleFactor.
|
||||
fill.Scale(1.0 / mFontSizeScaleFactor);
|
||||
|
||||
|
@ -0,0 +1,3 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg">
|
||||
<rect width="100" height="100" fill="green"/>
|
||||
</svg>
|
After Width: | Height: | Size: 96 B |
@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:h="http://www.w3.org/1999/xhtml">
|
||||
<metadata>
|
||||
<title>lengthAdjust="spacingAndGlyphs" should work on vertical text</title>
|
||||
<h:link rel="help" href="https://www.w3.org/TR/SVG2/text.html#TextElementLengthAdjustAttribute"/>
|
||||
<h:link rel="match" href="green-100x100.svg"/>
|
||||
<h:link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
|
||||
</metadata>
|
||||
<style>
|
||||
text {
|
||||
font: 25px/1 Ahem;
|
||||
}
|
||||
</style>
|
||||
<rect fill="green" width="100" height="100"/>
|
||||
<text x="50" y="10" fill="red" textLength="80" lengthAdjust="spacingAndGlyphs" font-family="Ahem" style="writing-mode: vertical-lr">
|
||||
XX
|
||||
</text>
|
||||
<rect fill="green" x="37" y="9" width="26" height="82"/>
|
||||
</svg>
|
After Width: | Height: | Size: 779 B |
Loading…
Reference in New Issue
Block a user