kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #21179
[PATCH] Correctly handle justification in LIB_TEXT::Plot
LIB_TEXT::Plot doesn't take justification into account, so when generating postscript/PDF/etc with left/right-justified text, the text is in the wrong position. This patch fixes that.
--
Chris
commit 54feccf699042b15f42ec95f834ee2b123fac883
Author: Chris Pavlina <cpavlin1@xxxxxxxxxxxxxx>
Date: Sat Nov 7 23:10:40 2015 -0500
Correctly handle justification in LIB_TEXT::Plot
diff --git a/eeschema/lib_text.cpp b/eeschema/lib_text.cpp
index 10c831b..e931a1f 100644
--- a/eeschema/lib_text.cpp
+++ b/eeschema/lib_text.cpp
@@ -307,10 +307,15 @@ void LIB_TEXT::Plot( PLOTTER* plotter, const wxPoint& offset, bool fill,
{
wxASSERT( plotter != NULL );
+ EDA_RECT bBox = GetBoundingBox();
+ // convert coordinates from draw Y axis to libedit Y axis
+ bBox.RevertYAxis();
+ wxPoint txtpos = bBox.Centre();
+
/* The text orientation may need to be flipped if the
* transformation matrix causes xy axes to be flipped. */
int t1 = ( aTransform.x1 != 0 ) ^ ( m_Orient != 0 );
- wxPoint pos = aTransform.TransformCoordinate( m_Pos ) + offset;
+ wxPoint pos = aTransform.TransformCoordinate( txtpos ) + offset;
// Get color
EDA_COLOR_T color;
Follow ups