Bug 595209 patch 1 - stroke scales badly with positioned glyphs r=roc,a=blocking-final+

This commit is contained in:
Robert Longson 2010-10-29 08:18:03 +01:00
parent 7f8fdfd939
commit f78cb7bc3f

View File

@ -131,6 +131,13 @@ public:
PRBool SetupForDirectTextRunMetrics(gfxContext *aContext) {
return SetupForDirectTextRun(aContext, mMetricsScale);
}
/**
* 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) {
aContext->SetLineWidth(aContext->CurrentLineWidth() / mDrawScale);
}
/**
* Returns the index of the next char in the string that should be
@ -553,6 +560,7 @@ void
nsSVGGlyphFrame::AddCharactersToPath(CharacterIterator *aIter,
gfxContext *aContext)
{
aIter->SetLineWidthForDrawing(aContext);
if (aIter->SetupForDirectTextRunDrawing(aContext)) {
mTextRun->DrawToPath(aContext, gfxPoint(0, 0), 0,
mTextRun->GetLength(), nsnull, nsnull);
@ -1626,9 +1634,6 @@ CharacterIterator::SetupForDirectTextRun(gfxContext *aContext, float aScale)
aContext->SetMatrix(mInitialMatrix);
aContext->Translate(mSource->mPosition);
aContext->Scale(aScale, aScale);
// 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
aContext->SetLineWidth(aContext->CurrentLineWidth() / aScale);
return PR_TRUE;
}
@ -1688,9 +1693,6 @@ CharacterIterator::SetupFor(gfxContext *aContext, float aScale)
aContext->Rotate(mPositions[mCurrentChar].angle);
aContext->Scale(aScale, aScale);
}
// 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
aContext->SetLineWidth(aContext->CurrentLineWidth() / aScale);
}
CharacterPosition