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:
parent
7872f1ec15
commit
5832e37177
|
@ -255,6 +255,9 @@ void STROKE_FONT::drawSingleLineText( const UTF8& aText )
|
||||||
VECTOR2D textSize = computeTextLineSize( aText );
|
VECTOR2D textSize = computeTextLineSize( aText );
|
||||||
double half_thickness = m_gal->GetLineWidth()/2;
|
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
|
// First adjust: the text X position is corrected by half_thickness
|
||||||
// because when the text with thickness is draw, its full size is textSize,
|
// 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
|
// 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.
|
// to place the text inside the 0 to textSize X area.
|
||||||
m_gal->Translate( VECTOR2D( half_thickness, 0 ) );
|
m_gal->Translate( VECTOR2D( half_thickness, 0 ) );
|
||||||
|
|
||||||
m_gal->Save();
|
|
||||||
|
|
||||||
// Adjust the text position to the given horizontal justification
|
// Adjust the text position to the given horizontal justification
|
||||||
switch( m_gal->GetHorizontalJustify() )
|
switch( m_gal->GetHorizontalJustify() )
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue