[gimp/gimp-2-10] Issue #2489 - Gimp 2.10.8 layer menu text along path



commit cd55cb3102d15f348d1353a7f4e9a32c498ed500
Author: ONO Yoshio <ohtsuka yoshio gmail com>
Date:   Tue Nov 13 11:30:49 2018 +0900

    Issue #2489 - Gimp 2.10.8 layer menu text along path
    
    Related #2064 - text along path not working with vertical text.
    
    (cherry picked from commit a2da1cd596b90d431d3f754cab02eeb9fdf202c5)

 app/actions/layers-commands.c | 36 ++++++++++++++++++++++++++++++++++--
 1 file changed, 34 insertions(+), 2 deletions(-)
---
diff --git a/app/actions/layers-commands.c b/app/actions/layers-commands.c
index 482fde9cd9..4d15d0294b 100644
--- a/app/actions/layers-commands.c
+++ b/app/actions/layers-commands.c
@@ -57,6 +57,8 @@
 #include "text/gimptext-vectors.h"
 #include "text/gimptextlayer.h"
 
+#include "vectors/gimpstroke.h"
+#include "vectors/gimpvectors.h"
 #include "vectors/gimpvectors-warp.h"
 
 #include "widgets/gimpaction.h"
@@ -656,12 +658,42 @@ layers_text_along_vectors_cmd_callback (GtkAction *action,
 
   if (GIMP_IS_TEXT_LAYER (layer))
     {
+      gdouble      box_width;
+      gdouble      box_height;
       GimpVectors *new_vectors;
+      gdouble      offset;
+
+      box_width  = gimp_item_get_width  (GIMP_ITEM (layer));
+      box_height = gimp_item_get_height (GIMP_ITEM (layer));
 
       new_vectors = gimp_text_vectors_new (image, GIMP_TEXT_LAYER (layer)->text);
 
-      gimp_vectors_warp_vectors (vectors, new_vectors,
-                                 0.5 * gimp_item_get_height (GIMP_ITEM (layer)));
+      offset = 0;
+      switch (GIMP_TEXT_LAYER (layer)->text->base_dir)
+        {
+        case GIMP_TEXT_DIRECTION_LTR:
+        case GIMP_TEXT_DIRECTION_RTL:
+          offset = 0.5 * box_height;
+          break;
+        case GIMP_TEXT_DIRECTION_TTB_RTL:
+        case GIMP_TEXT_DIRECTION_TTB_RTL_UPRIGHT:
+        case GIMP_TEXT_DIRECTION_TTB_LTR:
+        case GIMP_TEXT_DIRECTION_TTB_LTR_UPRIGHT:
+          {
+            GimpStroke *stroke = NULL;
+
+            while ((stroke = gimp_vectors_stroke_get_next (new_vectors, stroke)))
+              {
+                gimp_stroke_rotate (stroke, 0, 0, 270);
+                gimp_stroke_translate (stroke, 0, box_width);
+              }
+          }
+          offset = 0.5 * box_width;
+          break;
+        }
+
+
+      gimp_vectors_warp_vectors (vectors, new_vectors, offset);
 
       gimp_item_set_visible (GIMP_ITEM (new_vectors), TRUE, FALSE);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]