~ubuntu-branches/ubuntu/jaunty/gimp/jaunty-security

« back to all changes in this revision

Viewing changes to app/text/gimptextlayout-render.c

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Holbach
  • Date: 2007-05-02 16:33:03 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20070502163303-bvzhjzbpw8qglc4y
Tags: 2.3.16-1ubuntu1
* Resynchronized with Debian, remaining Ubuntu changes:
  - debian/rules: i18n magic.
* debian/control.in:
  - Maintainer: Ubuntu Core Developers <ubuntu-devel@lists.ubuntu.com>
* debian/patches/02_help-message.patch,
  debian/patches/03_gimp.desktop.in.in.patch,
  debian/patches/10_dont_show_wizard.patch: updated.
* debian/patches/04_composite-signedness.patch,
  debian/patches/05_add-letter-spacing.patch: dropped, used upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* The GIMP -- an image manipulation program
 
1
/* GIMP - The GNU Image Manipulation Program
2
2
 * Copyright (C) 1995 Spencer Kimball and Peter Mattis
3
3
 *
4
4
 * GimpText
19
19
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20
20
 */
21
21
 
 
22
#define PANGO_ENABLE_ENGINE 1
 
23
 
22
24
#include "config.h"
23
25
 
24
26
#include <glib-object.h>
25
27
#include <pango/pangoft2.h>
 
28
#include <pango/pango-font.h>
26
29
 
27
30
#include "text-types.h"
28
31
 
46
49
 */
47
50
 
48
51
static void  gimp_text_layout_render_line    (GimpTextLayout     *layout,
49
 
                                              PangoLayoutLine    *line,
50
 
                                              GimpTextRenderFunc  render_func,
51
 
                                              gint                x,
52
 
                                              gint                y,
53
 
                                              gpointer            render_data);
 
52
                                              PangoLayoutLine    *line,
 
53
                                              GimpTextRenderFunc  render_func,
 
54
                                              gint                x,
 
55
                                              gint                y,
 
56
                                              gpointer            render_data);
54
57
static void  gimp_text_layout_render_glyphs  (GimpTextLayout     *layout,
55
 
                                              PangoFont          *font,
56
 
                                              PangoGlyphString   *glyphs,
57
 
                                              GimpTextRenderFunc  render_func,
58
 
                                              gint                x,
59
 
                                              gint                y,
60
 
                                              gpointer            render_data);
 
58
                                              PangoFont          *font,
 
59
                                              PangoGlyphString   *glyphs,
 
60
                                              GimpTextRenderFunc  render_func,
 
61
                                              gint                x,
 
62
                                              gint                y,
 
63
                                              gpointer            render_data);
61
64
static FT_Int32   gimp_text_layout_render_flags (GimpTextLayout  *layout);
62
65
static void       gimp_text_layout_render_trafo (GimpTextLayout  *layout,
63
66
                                                 FT_Matrix       *trafo);
66
69
 
67
70
void
68
71
gimp_text_layout_render (GimpTextLayout     *layout,
69
 
                         GimpTextRenderFunc  render_func,
70
 
                         gpointer            render_data)
 
72
                         GimpTextRenderFunc  render_func,
 
73
                         gpointer            render_data)
71
74
{
72
75
  PangoLayoutIter *iter;
73
76
  gint             x, y;
94
97
      baseline = pango_layout_iter_get_baseline (iter);
95
98
 
96
99
      gimp_text_layout_render_line (layout, line,
97
 
                                    render_func,
98
 
                                    x + rect.x,
99
 
                                    y + baseline,
100
 
                                    render_data);
 
100
                                    render_func,
 
101
                                    x + rect.x,
 
102
                                    y + baseline,
 
103
                                    render_data);
101
104
    }
102
105
  while (pango_layout_iter_next_line (iter));
103
106
 
106
109
 
107
110
static void
108
111
gimp_text_layout_render_line (GimpTextLayout     *layout,
109
 
                              PangoLayoutLine    *line,
110
 
                              GimpTextRenderFunc  render_func,
111
 
                              gint                x,
112
 
                              gint                y,
113
 
                              gpointer            render_data)
 
112
                              PangoLayoutLine    *line,
 
113
                              GimpTextRenderFunc  render_func,
 
114
                              gint                x,
 
115
                              gint                y,
 
116
                              gpointer            render_data)
114
117
{
115
118
  PangoRectangle  rect;
116
119
  GSList         *list;
121
124
      PangoLayoutRun *run = list->data;
122
125
 
123
126
      pango_glyph_string_extents (run->glyphs, run->item->analysis.font,
124
 
                                  NULL, &rect);
 
127
                                  NULL, &rect);
125
128
      gimp_text_layout_render_glyphs (layout,
126
 
                                      run->item->analysis.font, run->glyphs,
127
 
                                      render_func,
128
 
                                      x + x_off, y,
129
 
                                      render_data);
 
129
                                      run->item->analysis.font, run->glyphs,
 
130
                                      render_func,
 
131
                                      x + x_off, y,
 
132
                                      render_data);
130
133
 
131
134
      x_off += rect.width;
132
135
    }
134
137
 
135
138
static void
136
139
gimp_text_layout_render_glyphs (GimpTextLayout     *layout,
137
 
                                PangoFont          *font,
138
 
                                PangoGlyphString   *glyphs,
139
 
                                GimpTextRenderFunc  render_func,
140
 
                                gint                x,
141
 
                                gint                y,
142
 
                                gpointer            render_data)
 
140
                                PangoFont          *font,
 
141
                                PangoGlyphString   *glyphs,
 
142
                                GimpTextRenderFunc  render_func,
 
143
                                gint                x,
 
144
                                gint                y,
 
145
                                gpointer            render_data)
143
146
{
144
147
  PangoGlyphInfo *gi;
145
148
  FT_Int32        flags;
153
156
 
154
157
  for (i = 0, gi = glyphs->glyphs; i < glyphs->num_glyphs; i++, gi++)
155
158
    {
156
 
      if (gi->glyph)
157
 
        {
158
 
          pos.x = x + x_position + gi->geometry.x_offset;
159
 
          pos.y = y + gi->geometry.y_offset;
160
 
 
161
 
          FT_Vector_Transform (&pos, &trafo);
162
 
 
163
 
          render_func (font, gi->glyph, flags, &trafo,
164
 
                       pos.x, pos.y,
165
 
                       render_data);
166
 
        }
 
159
      if (gi->glyph != PANGO_GLYPH_EMPTY)
 
160
        {
 
161
          pos.x = x + x_position + gi->geometry.x_offset;
 
162
          pos.y = y + gi->geometry.y_offset;
 
163
 
 
164
          FT_Vector_Transform (&pos, &trafo);
 
165
 
 
166
          render_func (font, gi->glyph, flags, &trafo,
 
167
                       pos.x, pos.y,
 
168
                       render_data);
 
169
        }
167
170
 
168
171
      x_position += glyphs->glyphs[i].geometry.width;
169
172
    }