Issue #2489 - Gimp 2.10.8 layer menu text along path

Related #2064 - text along path not working with vertical text.
This commit is contained in:
ONO Yoshio 2018-11-13 11:30:49 +09:00
parent 0c20d2bf55
commit a2da1cd596

View file

@ -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);