Loading common/gal/stroke_font.cpp +28 −11 Original line number Original line Diff line number Diff line Loading @@ -98,7 +98,8 @@ bool STROKE_FONT::LoadNewStrokeFont( const char* const aNewStrokeFont[], int aNe // Every coordinate description of the Hershey format has an offset, // Every coordinate description of the Hershey format has an offset, // it has to be subtracted // it has to be subtracted point.x = (double) ( coordinate[0] - 'R' ) * HERSHEY_SCALE - glyphStartX; point.x = (double) ( coordinate[0] - 'R' ) * HERSHEY_SCALE - glyphStartX; point.y = (double) ( coordinate[1] - 'R' ) * HERSHEY_SCALE; // -10 is here to keep GAL rendering consistent with the legacy gfx stuff point.y = (double) ( coordinate[1] - 'R' - 10) * HERSHEY_SCALE; pointList.push_back( point ); pointList.push_back( point ); } } Loading Loading @@ -161,25 +162,41 @@ void STROKE_FONT::Draw( const UTF8& aText, const VECTOR2D& aPosition, double aRo // Single line height // Single line height int lineHeight = getInterline( ); int lineHeight = getInterline( ); int lineCount = linesCount( aText ); // The overall height of all lines of text // align the 1st line of text double textBlockHeight = lineHeight * ( linesCount( aText ) - 1 ); switch( m_verticalJustify ) switch( m_verticalJustify ) { { case GR_TEXT_VJUSTIFY_TOP: m_gal->Translate( VECTOR2D( 0, m_glyphSize.y ) ); break; case GR_TEXT_VJUSTIFY_CENTER: case GR_TEXT_VJUSTIFY_CENTER: m_gal->Translate( VECTOR2D( 0, -textBlockHeight / 2.0 ) ); m_gal->Translate( VECTOR2D( 0, m_glyphSize.y / 2.0 ) ); break; break; case GR_TEXT_VJUSTIFY_BOTTOM: case GR_TEXT_VJUSTIFY_BOTTOM: m_gal->Translate( VECTOR2D( 0, -textBlockHeight ) ); break; break; default: break; } if( lineCount > 1 ) { switch( m_verticalJustify ) { case GR_TEXT_VJUSTIFY_TOP: case GR_TEXT_VJUSTIFY_TOP: break; break; default: case GR_TEXT_VJUSTIFY_CENTER: m_gal->Translate( VECTOR2D(0, -( lineCount - 1 ) * lineHeight / 2) ); break; break; case GR_TEXT_VJUSTIFY_BOTTOM: m_gal->Translate( VECTOR2D(0, -( lineCount - 1 ) * lineHeight ) ); break; } } } m_gal->SetIsStroke( true ); m_gal->SetIsStroke( true ); Loading Loading
common/gal/stroke_font.cpp +28 −11 Original line number Original line Diff line number Diff line Loading @@ -98,7 +98,8 @@ bool STROKE_FONT::LoadNewStrokeFont( const char* const aNewStrokeFont[], int aNe // Every coordinate description of the Hershey format has an offset, // Every coordinate description of the Hershey format has an offset, // it has to be subtracted // it has to be subtracted point.x = (double) ( coordinate[0] - 'R' ) * HERSHEY_SCALE - glyphStartX; point.x = (double) ( coordinate[0] - 'R' ) * HERSHEY_SCALE - glyphStartX; point.y = (double) ( coordinate[1] - 'R' ) * HERSHEY_SCALE; // -10 is here to keep GAL rendering consistent with the legacy gfx stuff point.y = (double) ( coordinate[1] - 'R' - 10) * HERSHEY_SCALE; pointList.push_back( point ); pointList.push_back( point ); } } Loading Loading @@ -161,25 +162,41 @@ void STROKE_FONT::Draw( const UTF8& aText, const VECTOR2D& aPosition, double aRo // Single line height // Single line height int lineHeight = getInterline( ); int lineHeight = getInterline( ); int lineCount = linesCount( aText ); // The overall height of all lines of text // align the 1st line of text double textBlockHeight = lineHeight * ( linesCount( aText ) - 1 ); switch( m_verticalJustify ) switch( m_verticalJustify ) { { case GR_TEXT_VJUSTIFY_TOP: m_gal->Translate( VECTOR2D( 0, m_glyphSize.y ) ); break; case GR_TEXT_VJUSTIFY_CENTER: case GR_TEXT_VJUSTIFY_CENTER: m_gal->Translate( VECTOR2D( 0, -textBlockHeight / 2.0 ) ); m_gal->Translate( VECTOR2D( 0, m_glyphSize.y / 2.0 ) ); break; break; case GR_TEXT_VJUSTIFY_BOTTOM: case GR_TEXT_VJUSTIFY_BOTTOM: m_gal->Translate( VECTOR2D( 0, -textBlockHeight ) ); break; break; default: break; } if( lineCount > 1 ) { switch( m_verticalJustify ) { case GR_TEXT_VJUSTIFY_TOP: case GR_TEXT_VJUSTIFY_TOP: break; break; default: case GR_TEXT_VJUSTIFY_CENTER: m_gal->Translate( VECTOR2D(0, -( lineCount - 1 ) * lineHeight / 2) ); break; break; case GR_TEXT_VJUSTIFY_BOTTOM: m_gal->Translate( VECTOR2D(0, -( lineCount - 1 ) * lineHeight ) ); break; } } } m_gal->SetIsStroke( true ); m_gal->SetIsStroke( true ); Loading