Significance of "width != 1" in Pango layouts?
- From: Tony Graham <Tony Graham ireland sun com>
- To: gtk-i18n-list gnome org
- Subject: Significance of "width != 1" in Pango layouts?
- Date: Mon, 10 Sep 2001 13:45:14 +0100
The definition of pango_x_render_layout() in pangox.c (and similar
code in pangoft2.c, etc.) contains:
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)
{
PangoLayoutLine *line = tmp_list->data;
int x_offset;
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;
I believe that I understand the significance of the "width == -1" test
-- if true, the lines aren't wrapped -- but I don't understand the
significance of "width == 1", especially since I can't find any code
that explicitly sets a layouts width to 1.
Also, since the width is in Pango units, the width would have to be a
lot larger than 1 before the changes in x_offset made any visible
difference.
What is the significance of testing that width != 1?
Regards,
Tony Graham
------------------------------------------------------------------------
XML Technology Center - Dublin mailto:tony graham ireland sun com
Sun Microsystems Ireland Ltd Phone: +353 1 8199708
Hamilton House, East Point Business Park, Dublin 3 x(70)19708
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]