From bbc596ad6cd92c95e010f21048a8ec17ef3dd52a Mon Sep 17 00:00:00 2001 From: Baranovskiy Konstantin Date: Sat, 16 Nov 2013 20:31:07 -0500 Subject: [PATCH] Fix justification of vertically aligned multi-line text. --- common/eda_text.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/common/eda_text.cpp b/common/eda_text.cpp index 1ee1906c31..65bebe5764 100644 --- a/common/eda_text.cpp +++ b/common/eda_text.cpp @@ -40,7 +40,7 @@ // because the text position is sometimes critical. // Currently, this change is broken for rotated or mirrored texts, // so keep this line commented until there are fixes -//#define FIX_MULTILINE_VERT_JUSTIF +#define FIX_MULTILINE_VERT_JUSTIF // Conversion to application internal units defined at build time. #if defined( PCBNEW ) @@ -267,9 +267,13 @@ void EDA_TEXT::Draw( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint& aOffset, { if( m_MultilineAllowed ) { - wxPoint pos = m_Pos; wxArrayString* list = wxStringSplit( m_Text, '\n' ); - wxPoint offset; + + wxPoint pos = m_Pos; // Position of first line of the + // multiline text according to + // the center of the multiline text block + + wxPoint offset; // Offset to next line. offset.y = GetInterline(); @@ -290,7 +294,12 @@ void EDA_TEXT::Draw( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint& aOffset, break; } } + + // Rotate the position of the first line + // around the center of the multiline text block + RotatePoint( &pos, m_Pos, m_Orient ); #endif + // Rotate the offset lines to increase happened in the right direction RotatePoint( &offset, m_Orient ); for( unsigned i = 0; iCount(); i++ )