2006-12-10 05:33:38 +08:00
|
|
|
/* GIMP - The GNU Image Manipulation Program
|
2003-07-07 02:43:58 +08:00
|
|
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
|
|
|
*
|
|
|
|
* GimpText
|
|
|
|
* Copyright (C) 2002-2003 Sven Neumann <sven@gimp.org>
|
|
|
|
*
|
2009-01-18 06:28:01 +08:00
|
|
|
* This program is free software: you can redistribute it and/or modify
|
2003-07-07 02:43:58 +08:00
|
|
|
* it under the terms of the GNU General Public License as published by
|
2009-01-18 06:28:01 +08:00
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
2003-07-07 02:43:58 +08:00
|
|
|
* (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
|
2009-01-18 06:28:01 +08:00
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2003-07-07 02:43:58 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
2008-10-27 01:39:55 +08:00
|
|
|
#include <pango/pangocairo.h>
|
2003-07-07 02:43:58 +08:00
|
|
|
|
|
|
|
#include "text-types.h"
|
|
|
|
|
|
|
|
#include "gimptextlayout.h"
|
|
|
|
#include "gimptextlayout-render.h"
|
|
|
|
|
|
|
|
|
2003-07-21 05:23:01 +08:00
|
|
|
void
|
2010-02-22 00:47:21 +08:00
|
|
|
gimp_text_layout_render (GimpTextLayout *layout,
|
|
|
|
cairo_t *cr,
|
|
|
|
GimpTextDirection base_dir,
|
|
|
|
gboolean path)
|
2003-07-07 02:43:58 +08:00
|
|
|
{
|
2008-11-04 07:44:19 +08:00
|
|
|
PangoLayout *pango_layout;
|
2008-11-04 07:25:05 +08:00
|
|
|
cairo_matrix_t trafo;
|
|
|
|
gint x, y;
|
2003-07-07 02:43:58 +08:00
|
|
|
|
2003-07-21 05:23:01 +08:00
|
|
|
g_return_if_fail (GIMP_IS_TEXT_LAYOUT (layout));
|
2008-11-04 07:25:05 +08:00
|
|
|
g_return_if_fail (cr != NULL);
|
2003-07-07 02:43:58 +08:00
|
|
|
|
2014-04-11 22:52:42 +08:00
|
|
|
cairo_save (cr);
|
2003-07-07 02:43:58 +08:00
|
|
|
|
2014-04-11 22:52:42 +08:00
|
|
|
gimp_text_layout_get_offsets (layout, &x, &y);
|
2008-11-04 07:25:05 +08:00
|
|
|
cairo_translate (cr, x, y);
|
2008-10-27 01:39:55 +08:00
|
|
|
|
2009-06-19 23:08:34 +08:00
|
|
|
gimp_text_layout_get_transform (layout, &trafo);
|
2008-11-04 07:25:05 +08:00
|
|
|
cairo_transform (cr, &trafo);
|
2003-07-07 02:43:58 +08:00
|
|
|
|
2010-03-12 03:50:16 +08:00
|
|
|
pango_layout = gimp_text_layout_get_pango_layout (layout);
|
|
|
|
|
2008-11-04 07:25:05 +08:00
|
|
|
if (path)
|
2008-11-04 07:44:19 +08:00
|
|
|
pango_cairo_layout_path (cr, pango_layout);
|
2008-11-04 07:25:05 +08:00
|
|
|
else
|
2008-11-04 07:44:19 +08:00
|
|
|
pango_cairo_show_layout (cr, pango_layout);
|
2014-04-11 22:52:42 +08:00
|
|
|
|
|
|
|
cairo_restore (cr);
|
2003-07-07 02:43:58 +08:00
|
|
|
}
|