1
1
mirror of https://gitlab.gnome.org/GNOME/gimp.git synced 2025-10-06 01:12:40 +02:00
Files
gimp/app/text/gimptextlayout-render.c
ONO Yoshio 587d9bbb03 MR !19: Add support for vertical text writing.
Squashed commit of the following:

commit ee1ff7d502658cfa1248a13a3f0348495db07eda
Author: ONO Yoshio <ohtsuka.yoshio@gmail.com>
Date:   Sun Jul 29 00:31:47 2018 +0900

    Fixed that gimp-text-dir-ttb-* icons are lacked in Symbolic.

commit d87d012d697628da28fe90199cc04b95b72ba8ef
Author: ONO Yoshio <ohtsuka.yoshio@gmail.com>
Date:   Sat Jul 28 16:23:10 2018 +0900

    Fix a typo.

commit cf0238bf7df56c384cdf3b7ec69557d14740f853
Author: ONO Yoshio <ohtsuka.yoshio@gmail.com>
Date:   Sat Jul 28 15:50:57 2018 +0900

    Fixed seg fault error.

commit b07f60d06fa1a753fda5b4d46af01698c344154e
Author: ONO Yoshio <ohtsuka.yoshio@gmail.com>
Date:   Fri Jul 27 17:15:34 2018 +0900

    Add support for vertical text writing.

    https://gitlab.gnome.org/GNOME/gimp/issues/641
2018-07-30 19:14:49 +02:00

78 lines
2.2 KiB
C

/* GIMP - The GNU Image Manipulation Program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* GimpText
* Copyright (C) 2002-2003 Sven Neumann <sven@gimp.org>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "config.h"
#include <pango/pangocairo.h>
#include "text-types.h"
#include "gimptextlayout.h"
#include "gimptextlayout-render.h"
void
gimp_text_layout_render (GimpTextLayout *layout,
cairo_t *cr,
GimpTextDirection base_dir,
gboolean path)
{
PangoLayout *pango_layout;
cairo_matrix_t trafo;
gint x, y;
gint width, height;
g_return_if_fail (GIMP_IS_TEXT_LAYOUT (layout));
g_return_if_fail (cr != NULL);
cairo_save (cr);
gimp_text_layout_get_offsets (layout, &x, &y);
cairo_translate (cr, x, y);
gimp_text_layout_get_transform (layout, &trafo);
cairo_transform (cr, &trafo);
if (base_dir == GIMP_TEXT_DIRECTION_TTB_RTL ||
base_dir == GIMP_TEXT_DIRECTION_TTB_RTL_UPRIGHT)
{
gimp_text_layout_get_size (layout, &width, &height);
cairo_translate (cr, width, 0);
cairo_rotate (cr, G_PI_2);
}
if (base_dir == GIMP_TEXT_DIRECTION_TTB_LTR ||
base_dir == GIMP_TEXT_DIRECTION_TTB_LTR_UPRIGHT)
{
gimp_text_layout_get_size (layout, &width, &height);
cairo_translate (cr, 0, height);
cairo_rotate (cr, -G_PI_2);
}
pango_layout = gimp_text_layout_get_pango_layout (layout);
if (path)
pango_cairo_layout_path (cr, pango_layout);
else
pango_cairo_show_layout (cr, pango_layout);
cairo_restore (cr);
}