summaryrefslogtreecommitdiff
path: root/gdk/gdkpango.c
diff options
context:
space:
mode:
authorHavoc Pennington <hp@redhat.com>2000-11-13 18:49:52 +0000
committerHavoc Pennington <hp@src.gnome.org>2000-11-13 18:49:52 +0000
commit15e0004b109b85f15556b2d09d0d703c9c0534f7 (patch)
tree5747ab72346376c1500efa71aedb0156efc1cbd0 /gdk/gdkpango.c
parentbe698675c7c043e3161362b99b9dc656531c91b4 (diff)
downloadgdk-pixbuf-15e0004b109b85f15556b2d09d0d703c9c0534f7.tar.gz
Free the filename of the module file.
2000-11-13 Havoc Pennington <hp@redhat.com> * gtk/gtkimmodule.c (gtk_im_module_init): Free the filename of the module file. * gtk/gtktexttag.c (gtk_text_attributes_copy): fix memory leak of dest->language * gtk/testtext.c: Test pixels above/below/inside paragraphs settings * gtk/gtktextview.c: Implement object args and setters/getters for all the aspects of the GtkTextAttributes that are not set from GtkWidget attributes. This is spacing, justification, margins, etc. (gtk_text_view_set_arg) (gtk_text_view_get_arg): implement get/set for editable, wrap mode args (gtk_text_view_class_init): Add args for justify, left_margin, right_margin, indent, and tabs * gtk/gtktextlayout.c (set_para_values): fix to display indent attribute properly * gtk/gtktexttag.c: Remove left_wrapped_line_margin attribute, replace with indent attribute * gtk/gtktextlayout.c (set_para_values): multiply indent by PANGO_SCALE * gtk/gtktextdisplay.c (render_para): Use PangoLayoutIter, rearranging code to do that (gtk_text_layout_draw): Pass in the y for the whole LineDisplay, i.e. don't subtract the top_margin first, just to keep all margin-futzing in one place. * gdk/gdkpango.c (gdk_draw_layout): Use PangoLayoutIter * gtk/gtktextlayout.c (gtk_text_layout_get_iter_location): Remove special case of last line, Pango now handles this itself. (gtk_text_layout_get_iter_at_pixel): Fix incorrect clamp of the Y coordinate (gtk_text_layout_move_iter_to_x): port to use PangoLayoutIter (find_display_line_above): wasn't moving the byte index as it iterated over lines, so always returned byte 0. Also, port to use PangoLayoutIter. (find_display_line_below): same problem as find_display_line_above. Also, port to use PangoLayoutIter.
Diffstat (limited to 'gdk/gdkpango.c')
-rw-r--r--gdk/gdkpango.c72
1 files changed, 16 insertions, 56 deletions
diff --git a/gdk/gdkpango.c b/gdk/gdkpango.c
index 2a10fcc8e..e0e9675ec 100644
--- a/gdk/gdkpango.c
+++ b/gdk/gdkpango.c
@@ -272,73 +272,33 @@ gdk_draw_layout (GdkDrawable *drawable,
int y,
PangoLayout *layout)
{
- PangoRectangle logical_rect;
- GSList *tmp_list;
- PangoAlignment align;
- gint indent;
- gint width;
- gint y_offset = 0;
- gboolean first = FALSE;
+ PangoLayoutIter *iter;
g_return_if_fail (drawable != NULL);
g_return_if_fail (gc != NULL);
g_return_if_fail (layout != NULL);
- indent = pango_layout_get_indent (layout);
- width = pango_layout_get_width (layout);
- align = pango_layout_get_alignment (layout);
-
- if (width == -1 && align != PANGO_ALIGN_LEFT)
- {
- pango_layout_get_extents (layout, NULL, &logical_rect);
- width = logical_rect.width;
- }
+ iter = pango_layout_get_iter (layout);
- tmp_list = pango_layout_get_lines (layout);
- while (tmp_list)
+ do
{
- PangoLayoutLine *line = tmp_list->data;
- int x_offset;
+ PangoRectangle logical_rect;
+ PangoLayoutLine *line;
+ int baseline;
+
+ line = pango_layout_iter_get_line (iter);
+
+ pango_layout_iter_get_line_extents (iter, NULL, &logical_rect);
+ baseline = pango_layout_iter_get_baseline (iter);
- pango_layout_line_get_extents (line, NULL, &logical_rect);
-
- if (width != -1 && align == PANGO_ALIGN_RIGHT)
- x_offset = width - logical_rect.width;
- else if (width != -1 && align == PANGO_ALIGN_CENTER)
- x_offset = (width - logical_rect.width) / 2;
- else
- x_offset = 0;
-
- if (first)
- {
- if (indent > 0)
- {
- if (align == PANGO_ALIGN_LEFT)
- x_offset += indent;
- else
- x_offset -= indent;
- }
-
- first = FALSE;
- }
- else
- {
- if (indent < 0)
- {
- if (align == PANGO_ALIGN_LEFT)
- x_offset -= indent;
- else
- x_offset += indent;
- }
- }
-
gdk_draw_layout_line (drawable, gc,
- x + x_offset / PANGO_SCALE, y + (y_offset - logical_rect.y) / PANGO_SCALE,
+ x + logical_rect.x / PANGO_SCALE,
+ y + baseline / PANGO_SCALE,
line);
-
- y_offset += logical_rect.height;
- tmp_list = tmp_list->next;
}
+ while (pango_layout_iter_next_line (iter));
+
+ pango_layout_iter_free (iter);
}
static void