mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 676178 - Scale stroke dashes to text size properly. r=jwatt
This commit is contained in:
parent
61fbc9c6dc
commit
00866bc80f
@ -235,6 +235,7 @@ fails-if(Android) random-if(gtk2Widget) != text-language-01.xhtml text-language-
|
||||
== text-scale-01.svg text-scale-01-ref.svg
|
||||
== text-stroke-scaling-01.svg text-stroke-scaling-01-ref.svg
|
||||
== stroke-dasharray-and-pathLength-01.svg pass.svg
|
||||
== stroke-dasharray-and-text-01.svg stroke-dasharray-and-text-01-ref.svg
|
||||
== stroke-linecap-square-w-zero-length-segs-01.svg pass.svg
|
||||
== stroke-linecap-square-w-zero-length-segs-02.svg pass.svg
|
||||
== textPath-01.svg textPath-01-ref.svg
|
||||
|
10
layout/reftests/svg/stroke-dasharray-and-text-01-ref.svg
Normal file
10
layout/reftests/svg/stroke-dasharray-and-text-01-ref.svg
Normal file
@ -0,0 +1,10 @@
|
||||
<!--
|
||||
Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/
|
||||
-->
|
||||
<svg xmlns="http://www.w3.org/2000/svg">
|
||||
<title>Test stroke-dasharray with text and zooming</title>
|
||||
<g fill="none" stroke-width="2" stroke="black" stroke-dasharray="20">
|
||||
<text font-size="100" x="100" y="100">|</text>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 357 B |
10
layout/reftests/svg/stroke-dasharray-and-text-01.svg
Normal file
10
layout/reftests/svg/stroke-dasharray-and-text-01.svg
Normal file
@ -0,0 +1,10 @@
|
||||
<!--
|
||||
Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/
|
||||
-->
|
||||
<svg xmlns="http://www.w3.org/2000/svg" reftest-zoom="2">
|
||||
<title>Test stroke-dasharray with text and zooming</title>
|
||||
<g fill="none" stroke-width="1" stroke="black" stroke-dasharray="10">
|
||||
<text font-size="50" x="50" y="50">|</text>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 371 B |
@ -137,8 +137,16 @@ public:
|
||||
* We are scaling the glyphs up/down to the size we want so we need to
|
||||
* inverse scale the outline widths of those glyphs so they are invariant
|
||||
*/
|
||||
void SetLineWidthForDrawing(gfxContext *aContext) {
|
||||
void SetLineWidthAndDashesForDrawing(gfxContext *aContext) {
|
||||
aContext->SetLineWidth(aContext->CurrentLineWidth() / mDrawScale);
|
||||
AutoFallibleTArray<gfxFloat, 10> dashes;
|
||||
gfxFloat dashOffset;
|
||||
if (aContext->CurrentDash(dashes, &dashOffset)) {
|
||||
for (PRUint32 i = 0; i < dashes.Length(); i++) {
|
||||
dashes[i] /= mDrawScale;
|
||||
}
|
||||
aContext->SetDash(dashes.Elements(), dashes.Length(), dashOffset / mDrawScale);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -546,7 +554,7 @@ void
|
||||
nsSVGGlyphFrame::AddCharactersToPath(CharacterIterator *aIter,
|
||||
gfxContext *aContext)
|
||||
{
|
||||
aIter->SetLineWidthForDrawing(aContext);
|
||||
aIter->SetLineWidthAndDashesForDrawing(aContext);
|
||||
if (aIter->SetupForDirectTextRunDrawing(aContext)) {
|
||||
mTextRun->DrawToPath(aContext, gfxPoint(0, 0), 0,
|
||||
mTextRun->GetLength(), nsnull, nsnull);
|
||||
|
Loading…
Reference in New Issue
Block a user