|
|
|
@ -140,30 +140,29 @@ BOX2D STROKE_FONT::computeBoundingBox( const Glyph& aGlyph, const VECTOR2D& aGly |
|
|
|
|
|
|
|
void STROKE_FONT::Draw( std::string aText, const VECTOR2D& aPosition, double aRotationAngle ) |
|
|
|
{ |
|
|
|
// Split multiline strings into separate ones and draw line by line
|
|
|
|
// By default overbar is turned off
|
|
|
|
m_overbar = false; |
|
|
|
|
|
|
|
// Context needs to be saved before any transformations
|
|
|
|
m_gal->Save(); |
|
|
|
|
|
|
|
m_gal->Translate( aPosition ); |
|
|
|
m_gal->Rotate( -aRotationAngle ); |
|
|
|
|
|
|
|
// Split multiline strings into separate ones and draw them line by line
|
|
|
|
size_t newlinePos = aText.find( '\n' ); |
|
|
|
|
|
|
|
if( newlinePos != std::string::npos ) |
|
|
|
{ |
|
|
|
VECTOR2D nextlinePosition( aPosition ); |
|
|
|
nextlinePosition += VECTOR2D( 0.0, m_glyphSize.y * 1.6 ); // FIXME remove magic number
|
|
|
|
VECTOR2D nextlinePosition = VECTOR2D( 0.0, m_glyphSize.y * LINE_HEIGHT_RATIO ); |
|
|
|
|
|
|
|
Draw( aText.substr( newlinePos + 1 ), nextlinePosition, aRotationAngle ); |
|
|
|
Draw( aText.substr( newlinePos + 1 ), nextlinePosition, 0.0 ); |
|
|
|
aText = aText.substr( 0, newlinePos ); |
|
|
|
} |
|
|
|
|
|
|
|
// Compute the text size
|
|
|
|
VECTOR2D textsize = computeTextSize( aText ); |
|
|
|
|
|
|
|
// By default overbar is turned off
|
|
|
|
m_overbar = false; |
|
|
|
|
|
|
|
// Context needs to be saved before any transformations
|
|
|
|
m_gal->Save(); |
|
|
|
|
|
|
|
m_gal->Translate( aPosition ); |
|
|
|
m_gal->Rotate( -aRotationAngle ); |
|
|
|
|
|
|
|
// Adjust the text position to the given alignment
|
|
|
|
switch( m_horizontalJustify ) |
|
|
|
{ |
|
|
|
|