← Back to team overview

kicad-developers team mailing list archive

Re: Vertical justify of the multiline text

 

Hello!

I fixed vertical justification of the rotated or mirrored text.
Patch was attached.

Regards,
Konstantin.


2013/10/25 jp charras <jp.charras@xxxxxxxxxx>

> Le 24/10/2013 23:03, Барановский Константин a écrit :
> > Currently alignment of the multiline text applied only for first line
> > and other lines just plased under it.
> > Attached patch allows to align the multiline text given the all lines of
> > the text.
> >
> > --
> > Baranovskiy Konstantin
>
> Thanks.
>
> I added your patch with some other fixes.
>
> --
> 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-12 15:47:20.301539981 +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 )
@@ -282,14 +282,29 @@
                 break;
 
             case GR_TEXT_VJUSTIFY_CENTER:
-                pos.y -= ( list->Count() - 1 ) * offset.y / 2;
+                pos.y -= ( (int)list->Count() - 1 ) * offset.y / 2;
                 break;
 
             case GR_TEXT_VJUSTIFY_BOTTOM:
-                pos.y -= ( list->Count() - 1 ) * offset.y;
+                pos.y -= ( (int)list->Count() - 1 ) * offset.y;
+                break;
+            }
+
+            switch( m_HJustify )
+            {
+            case GR_TEXT_HJUSTIFY_LEFT:
+                break;
+
+            case GR_TEXT_HJUSTIFY_CENTER:
+                pos.x -= ( (int)list->Count() - 1 ) * offset.x / 2;
+                break;
+
+            case GR_TEXT_HJUSTIFY_RIGHT:
+                pos.x -= ( (int)list->Count() - 1 ) * offset.x;
                 break;
             }
         }
+        RotatePoint( &pos, m_Pos, m_Orient );
 #endif
         RotatePoint( &offset, m_Orient );
 

Follow ups

References