← Back to team overview

kicad-developers team mailing list archive

Re: Vertical justify of the multiline text

 

> Thanks, but where is the patch? (there is no attachment).

Sorry, my fault :)
I'm started to write the message at home but finished at work and forgot to
attach the patch.

Regards,
Konstantin.


2013/11/14 jp charras <jp.charras@xxxxxxxxxx>

> Le 14/11/2013 07:17, Константин Барановский a écrit :
> > Wayne,
> > RotatePoint must be called twice. I'm added the comments to explain
> > why need both calls.
> >
> > jp charras,
> > I checked the display of text in PCBnew where to use multiline text
> > inside the zone.
> >
> > In attachment the edited patch where added comments and some
> optimization.
> >
> > Regards,
> >
> > Konstantin.
> >
>
> Thanks, but where is the patch? (there is no attachment).
>
> Multiline texts in zones do not uses exactly the bounding box.
> The bounding box is always an horizontal rectangle, which is not the
> case in zones (try a 45 deg multiline text)
>
> To show the bounding box, see TEXTE_PCB::Draw in class_pcb_text.cpp,
> line 110
>
> --
> Jean-Pierre CHARRAS
>
> _______________________________________________
> Mailing list: https://launchpad.net/~kicad-developers
> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help   : https://help.launchpad.net/ListHelp
>
--- kicad/common/eda_text.cpp	2013-11-12 07:10:51.276582000 +0200
+++ kicad/common/eda_text.cpp	2013-11-14 07:15:22.966665778 +0200
@@ -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 @@
 {
     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 @@
                 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; i<list->Count(); i++ )

Follow ups

References