diff options
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | ChangeLog.pre-1-10 | 8 | ||||
-rw-r--r-- | ChangeLog.pre-1-4 | 8 | ||||
-rw-r--r-- | ChangeLog.pre-1-6 | 8 | ||||
-rw-r--r-- | ChangeLog.pre-1-8 | 8 | ||||
-rw-r--r-- | pango/pangoft2.c | 87 | ||||
-rw-r--r-- | pango/pangowin32.c | 80 | ||||
-rw-r--r-- | pango/pangox.c | 76 |
8 files changed, 98 insertions, 185 deletions
@@ -1,3 +1,11 @@ +2003-04-02 Sven Neumann <sven@gimp.org> + + * pango/pangoft2.c (pango_ft2_render_layout) + * pango/pangowin32.c (pango_win32_render_layout) + * pango/pangox.c (pango_x_render_layout): use a PangoLayoutIter to + iterate over the lines and let render_layout_line() do the actual + rendering. Fixes bug #105292. + 2003-03-28 Sven Neumann <sven@gimp.org> * pango/pangoft2-fontmap.c diff --git a/ChangeLog.pre-1-10 b/ChangeLog.pre-1-10 index 919d1bcd..69cd0c2f 100644 --- a/ChangeLog.pre-1-10 +++ b/ChangeLog.pre-1-10 @@ -1,3 +1,11 @@ +2003-04-02 Sven Neumann <sven@gimp.org> + + * pango/pangoft2.c (pango_ft2_render_layout) + * pango/pangowin32.c (pango_win32_render_layout) + * pango/pangox.c (pango_x_render_layout): use a PangoLayoutIter to + iterate over the lines and let render_layout_line() do the actual + rendering. Fixes bug #105292. + 2003-03-28 Sven Neumann <sven@gimp.org> * pango/pangoft2-fontmap.c diff --git a/ChangeLog.pre-1-4 b/ChangeLog.pre-1-4 index 919d1bcd..69cd0c2f 100644 --- a/ChangeLog.pre-1-4 +++ b/ChangeLog.pre-1-4 @@ -1,3 +1,11 @@ +2003-04-02 Sven Neumann <sven@gimp.org> + + * pango/pangoft2.c (pango_ft2_render_layout) + * pango/pangowin32.c (pango_win32_render_layout) + * pango/pangox.c (pango_x_render_layout): use a PangoLayoutIter to + iterate over the lines and let render_layout_line() do the actual + rendering. Fixes bug #105292. + 2003-03-28 Sven Neumann <sven@gimp.org> * pango/pangoft2-fontmap.c diff --git a/ChangeLog.pre-1-6 b/ChangeLog.pre-1-6 index 919d1bcd..69cd0c2f 100644 --- a/ChangeLog.pre-1-6 +++ b/ChangeLog.pre-1-6 @@ -1,3 +1,11 @@ +2003-04-02 Sven Neumann <sven@gimp.org> + + * pango/pangoft2.c (pango_ft2_render_layout) + * pango/pangowin32.c (pango_win32_render_layout) + * pango/pangox.c (pango_x_render_layout): use a PangoLayoutIter to + iterate over the lines and let render_layout_line() do the actual + rendering. Fixes bug #105292. + 2003-03-28 Sven Neumann <sven@gimp.org> * pango/pangoft2-fontmap.c diff --git a/ChangeLog.pre-1-8 b/ChangeLog.pre-1-8 index 919d1bcd..69cd0c2f 100644 --- a/ChangeLog.pre-1-8 +++ b/ChangeLog.pre-1-8 @@ -1,3 +1,11 @@ +2003-04-02 Sven Neumann <sven@gimp.org> + + * pango/pangoft2.c (pango_ft2_render_layout) + * pango/pangowin32.c (pango_win32_render_layout) + * pango/pangox.c (pango_x_render_layout): use a PangoLayoutIter to + iterate over the lines and let render_layout_line() do the actual + rendering. Fixes bug #105292. + 2003-03-28 Sven Neumann <sven@gimp.org> * pango/pangoft2-fontmap.c diff --git a/pango/pangoft2.c b/pango/pangoft2.c index 7428bb1a..c283e1f8 100644 --- a/pango/pangoft2.c +++ b/pango/pangoft2.c @@ -895,80 +895,35 @@ pango_ft2_render_layout_line (FT_Bitmap *bitmap, void pango_ft2_render_layout (FT_Bitmap *bitmap, PangoLayout *layout, - int x, - int y) + int x, + int y) { - PangoRectangle logical_rect; - GSList *tmp_list; - PangoAlignment align; - int indent; - int width; - int y_offset = 0; + PangoLayoutIter *iter; - gboolean first = TRUE; - g_return_if_fail (bitmap != NULL); - g_return_if_fail (layout != NULL); + g_return_if_fail (PANGO_IS_LAYOUT (layout)); - indent = pango_layout_get_indent (layout); - width = pango_layout_get_width (layout); - align = pango_layout_get_alignment (layout); + iter = pango_layout_get_iter (layout); - PING (("x:%d y:%d indent:%d width:%d", x, y, indent, width)); - - if (width == -1 && align != PANGO_ALIGN_LEFT) - { - pango_layout_get_extents (layout, NULL, &logical_rect); - width = logical_rect.width; - } - - 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; - 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; - } - } - - PING (("x_offset:%d y_offset:%d logical_rect.y:%d logical_rect.height:%d", x_offset, y_offset, logical_rect.y, logical_rect.height)); - - pango_ft2_render_layout_line (bitmap, line, - x + PANGO_PIXELS (x_offset), - y + PANGO_PIXELS (y_offset - logical_rect.y)); - - y_offset += logical_rect.height; - tmp_list = tmp_list->next; + 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_ft2_render_layout_line (bitmap, + line, + x + PANGO_PIXELS (logical_rect.x), + y + PANGO_PIXELS (baseline)); } + while (pango_layout_iter_next_line (iter)); + + pango_layout_iter_free (iter); } /* This utility function is duplicated here and in pango-layout.c; should it be diff --git a/pango/pangowin32.c b/pango/pangowin32.c index 32cc78c1..f36029c8 100644 --- a/pango/pangowin32.c +++ b/pango/pangowin32.c @@ -813,72 +813,30 @@ pango_win32_render_layout (HDC hdc, int x, int y) { - PangoRectangle logical_rect; - GSList *tmp_list; - PangoAlignment align; - int indent; - int width; - int y_offset = 0; - - gboolean first = TRUE; - - g_return_if_fail (layout != NULL); + PangoLayoutIter *iter; - indent = pango_layout_get_indent (layout); - width = pango_layout_get_width (layout); - align = pango_layout_get_alignment (layout); + g_return_if_fail (hdc != NULL); + g_return_if_fail (PANGO_IS_LAYOUT (layout)); - if (width == -1 && align != PANGO_ALIGN_LEFT) - { - pango_layout_get_extents (layout, NULL, &logical_rect); - width = logical_rect.width; - } - - 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; - 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; - } - } - - pango_win32_render_layout_line (hdc, line, - x + PANGO_PIXELS (x_offset), - y + PANGO_PIXELS (y_offset - logical_rect.y)); - - y_offset += logical_rect.height; - tmp_list = tmp_list->next; + 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_win32_render_layout_line (hdc, + line, + x + PANGO_PIXELS (logical_rect.x), + y + PANGO_PIXELS (baseline)); } + while (pango_layout_iter_next_line (iter)); + + pango_layout_iter_free (iter); } /* This utility function is duplicated here and in pango-layout.c; should it be diff --git a/pango/pangox.c b/pango/pangox.c index a05fa7f1..1ce921b4 100644 --- a/pango/pangox.c +++ b/pango/pangox.c @@ -1645,72 +1645,32 @@ pango_x_render_layout (Display *display, int x, int y) { - PangoRectangle logical_rect; - GSList *tmp_list; - PangoAlignment align; - int indent; - int width; - int y_offset = 0; + PangoLayoutIter *iter; - gboolean first = TRUE; - g_return_if_fail (display != NULL); - g_return_if_fail (layout != NULL); + g_return_if_fail (PANGO_IS_LAYOUT (layout)); - indent = pango_layout_get_indent (layout); - width = pango_layout_get_width (layout); - align = pango_layout_get_alignment (layout); + iter = pango_layout_get_iter (layout); - if (width == -1 && align != PANGO_ALIGN_LEFT) - { - pango_layout_get_extents (layout, NULL, &logical_rect); - width = logical_rect.width; - } - - 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; - } - } - pango_x_render_layout_line (display, drawable, gc, - line, x + x_offset / PANGO_SCALE, y + (y_offset - logical_rect.y) / PANGO_SCALE); - - y_offset += logical_rect.height; - tmp_list = tmp_list->next; + line, + x + PANGO_PIXELS (logical_rect.x), + y + PANGO_PIXELS (baseline)); } + while (pango_layout_iter_next_line (iter)); + + pango_layout_iter_free (iter); } /* This utility function is duplicated here and in pango-layout.c; should it be |