GAL: Fix offset problem in multiline text rendering

Commit BZR 6703 introduced a minor horizontal adjustment for stroke
text rendering in GAL, but the Translate() call was done before
calling Save(). So, when this function was called multiple times a
residual offset carried over to each subsequent line.

bzr 6703 = git 67982a4
This commit is contained in:
José Ignacio Romero 2016-05-29 17:40:11 -04:00 committed by Chris Pavlina
parent 7872f1ec15
commit 5832e37177
1 changed files with 3 additions and 2 deletions

View File

@ -255,6 +255,9 @@ void STROKE_FONT::drawSingleLineText( const UTF8& aText )
VECTOR2D textSize = computeTextLineSize( aText );
double half_thickness = m_gal->GetLineWidth()/2;
// Context needs to be saved before any transformations
m_gal->Save();
// First adjust: the text X position is corrected by half_thickness
// because when the text with thickness is draw, its full size is textSize,
// but the position of lines is half_thickness to textSize - half_thickness
@ -262,8 +265,6 @@ void STROKE_FONT::drawSingleLineText( const UTF8& aText )
// to place the text inside the 0 to textSize X area.
m_gal->Translate( VECTOR2D( half_thickness, 0 ) );
m_gal->Save();
// Adjust the text position to the given horizontal justification
switch( m_gal->GetHorizontalJustify() )
{