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:
parent
0c20d2bf55
commit
a2da1cd596
1 changed files with 34 additions and 2 deletions
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue