Commit d77c56a1 authored by Behdad Esfahbod's avatar Behdad Esfahbod Committed by Behdad Esfahbod

Make GTK_JUSTIFY_FILL work, using pango_layout_set_justify() that works

2007-05-03  Behdad Esfahbod  <behdad@gnome.org>

        * gtk/gtklabel.c (gtk_label_ensure_layout):
        * gtk/gtktextlayout.c (set_para_values): Make GTK_JUSTIFY_FILL work,
        using pango_layout_set_justify() that works now. (#435675)


svn path=/trunk/; revision=17790
parent 7250d57a
2007-05-03 Behdad Esfahbod <behdad@gnome.org>
* gtk/gtklabel.c (gtk_label_ensure_layout):
* gtk/gtktextlayout.c (set_para_values): Make GTK_JUSTIFY_FILL work,
using pango_layout_set_justify() that works now. (#435675)
2007-05-03 Emmanuele Bassi <ebassi@gnome.org>
* gtk/gtksearchenginesimple.c (search_engine_simple_finalize): Remove
......
......@@ -2024,7 +2024,6 @@ gtk_label_ensure_layout (GtkLabel *label)
align = PANGO_ALIGN_CENTER;
break;
case GTK_JUSTIFY_FILL:
/* FIXME: This just doesn't work to do this */
align = rtl ? PANGO_ALIGN_RIGHT : PANGO_ALIGN_LEFT;
pango_layout_set_justify (label->layout, TRUE);
break;
......
......@@ -1201,7 +1201,7 @@ set_para_values (GtkTextLayout *layout,
GtkTextLineDisplay *display)
{
PangoAlignment pango_align = PANGO_ALIGN_LEFT;
int layout_width;
PangoWrapMode pango_wrap = PANGO_WRAP_WORD;
switch (base_dir)
{
......@@ -1241,7 +1241,8 @@ set_para_values (GtkTextLayout *layout,
pango_align = PANGO_ALIGN_CENTER;
break;
case GTK_JUSTIFY_FILL:
g_warning ("FIXME we don't support GTK_JUSTIFY_FILL yet");
pango_align = (base_dir == PANGO_DIRECTION_LTR) ? PANGO_ALIGN_LEFT : PANGO_ALIGN_RIGHT;
pango_layout_set_justify (display->layout, TRUE);
break;
default:
g_assert_not_reached ();
......@@ -1269,26 +1270,27 @@ set_para_values (GtkTextLayout *layout,
switch (style->wrap_mode)
{
case GTK_WRAP_CHAR:
layout_width = layout->screen_width - display->left_margin - display->right_margin;
pango_layout_set_width (display->layout, layout_width * PANGO_SCALE);
pango_layout_set_wrap (display->layout, PANGO_WRAP_CHAR);
pango_wrap = PANGO_WRAP_CHAR;
break;
case GTK_WRAP_WORD:
layout_width = layout->screen_width - display->left_margin - display->right_margin;
pango_layout_set_width (display->layout, layout_width * PANGO_SCALE);
pango_layout_set_wrap (display->layout, PANGO_WRAP_WORD);
pango_wrap = PANGO_WRAP_WORD;
break;
case GTK_WRAP_WORD_CHAR:
layout_width = layout->screen_width - display->left_margin - display->right_margin;
pango_layout_set_width (display->layout, layout_width * PANGO_SCALE);
pango_layout_set_wrap (display->layout, PANGO_WRAP_WORD_CHAR);
pango_wrap = PANGO_WRAP_WORD_CHAR;
break;
case GTK_WRAP_NONE:
break;
}
if (style->wrap_mode != GTK_WRAP_NONE)
{
int layout_width = (layout->screen_width - display->left_margin - display->right_margin);
pango_layout_set_width (display->layout, layout_width * PANGO_SCALE);
pango_layout_set_wrap (display->layout, pango_wrap);
}
display->total_width = MAX (layout->screen_width, layout->width) - display->left_margin - display->right_margin;
if (style->pg_bg_color)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment