summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@gnome.org>2005-11-09 07:43:09 +0000
committerBehdad Esfahbod <behdad@src.gnome.org>2005-11-09 07:43:09 +0000
commita671bf6772c2341ecb3bef9f6b0671603d2f9619 (patch)
tree44b0661219d21e3bd3e66a933cb06978a3ae0ec3
parentba2a78f0035834cd4031daa3d9097378affea072 (diff)
downloadpango-a671bf6772c2341ecb3bef9f6b0671603d2f9619.tar.gz
Set layout wrapping to PANGO_WRAP_WORD_CHAR if width is set for the
2005-11-09 Behdad Esfahbod <behdad@gnome.org> * examples/renderdemo.c (make_layout): Set layout wrapping to PANGO_WRAP_WORD_CHAR if width is set for the layout. Setting width didn't have any effect previously. * pango/pango-layout.c (process_item): Remove the excess letter_spacing adjustment on the item width. (#168593, Damon Chaplin) * pango/pango-markup.c (pango_parse_markup), pango/querymodules.c: Replace g_string_new ("") with g_string_new (NULL). * pango/pangoft2.c: Use g_malloc'ed memory for unknown FreeType2 error, instead of static buffer.
-rw-r--r--ChangeLog15
-rw-r--r--examples/renderdemo.c5
-rw-r--r--pango/pango-layout.c17
-rw-r--r--pango/pango-markup.c2
-rw-r--r--pango/pangoft2.c5
5 files changed, 30 insertions, 14 deletions
diff --git a/ChangeLog b/ChangeLog
index 56c43bfa..778e95a2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,20 @@
2005-11-09 Behdad Esfahbod <behdad@gnome.org>
+ * examples/renderdemo.c (make_layout): Set layout wrapping to
+ PANGO_WRAP_WORD_CHAR if width is set for the layout. Setting width
+ didn't have any effect previously.
+
+ * pango/pango-layout.c (process_item): Remove the excess
+ letter_spacing adjustment on the item width. (#168593, Damon Chaplin)
+
+ * pango/pango-markup.c (pango_parse_markup), pango/querymodules.c:
+ Replace g_string_new ("") with g_string_new (NULL).
+
+ * pango/pangoft2.c: Use g_malloc'ed memory for unknown FreeType2
+ error, instead of static buffer.
+
+2005-11-09 Behdad Esfahbod <behdad@gnome.org>
+
* modules/hebrew/.cvsignore, modules/khmer/.cvsignore,
modules/tibetan/.cvsignore: Minor clean up and adjustment.
diff --git a/examples/renderdemo.c b/examples/renderdemo.c
index 07ca1615..a956e3c6 100644
--- a/examples/renderdemo.c
+++ b/examples/renderdemo.c
@@ -111,7 +111,10 @@ make_layout(PangoContext *context,
pango_font_description_set_size (font_description, size * PANGO_SCALE);
if (opt_width > 0)
- pango_layout_set_width (layout, (opt_width * opt_dpi * PANGO_SCALE + 32) / 72);
+ {
+ pango_layout_set_wrap (layout, PANGO_WRAP_WORD_CHAR);
+ pango_layout_set_width (layout, (opt_width * opt_dpi * PANGO_SCALE + 32) / 72);
+ }
if (opt_indent != 0)
pango_layout_set_indent (layout, (opt_indent * opt_dpi * PANGO_SCALE + 32) / 72);
diff --git a/pango/pango-layout.c b/pango/pango-layout.c
index 24a1fcfb..f12443a5 100644
--- a/pango/pango-layout.c
+++ b/pango/pango-layout.c
@@ -2739,12 +2739,13 @@ insert_run (PangoLayoutLine *line,
}
/* Tries to insert as much as possible of the item at the head of
- * state->items onto @line. Three results are possible:
+ * state->items onto @line. Five results are possible:
*
- * BREAK_NONE_FIT: Couldn't fit anything
- * BREAK_SOME_FIT: The item was broken in the middle
+ * BREAK_NONE_FIT: Couldn't fit anything.
+ * BREAK_SOME_FIT: The item was broken in the middle.
* BREAK_ALL_FIT: Everything fit.
* BREAK_EMPTY_FIT: Nothing fit, but that was ok, as we can break at the first char.
+ * BREAK_LINE_SEPARATOR: Item begins with a line separator.
*
* If @force_fit is TRUE, then BREAK_NONE_FIT will never
* be returned, a run will be added even if inserting the minimum amount
@@ -2805,17 +2806,11 @@ process_item (PangoLayout *layout,
{
for (i = 0; i < state->glyphs->num_glyphs; i++)
width += state->glyphs->glyphs[i].geometry.width;
-
- /* We'll add half the letter spacing to each side of the item */
- width += state->properties.letter_spacing;
}
else
{
for (i = 0; i < item->num_chars; i++)
width += state->log_widths[state->log_widths_offset + i];
-
- /* In this case, the letter spacing width has already been
- * added to the last element in log_widths */
}
if ((width <= state->remaining_width || (item->num_chars == 1 && !line->runs)) &&
@@ -2843,7 +2838,7 @@ process_item (PangoLayout *layout,
state->log_widths);
/* The extra run letter spacing is actually divided after
- * the last and and before the first, but it works to
+ * the last and before the first, but it works to
* account it all on the last
*/
if (item->num_chars > 0)
@@ -3097,7 +3092,7 @@ pango_layout_get_effective_attributes (PangoLayout *layout)
{
PangoAttrList *attrs;
- if (layout->attrs)
+ if (layout->attrs)
attrs = pango_attr_list_copy (layout->attrs);
else
attrs = pango_attr_list_new ();
diff --git a/pango/pango-markup.c b/pango/pango-markup.c
index d2d39409..bd268d6b 100644
--- a/pango/pango-markup.c
+++ b/pango/pango-markup.c
@@ -601,7 +601,7 @@ pango_parse_markup (const char *markup_text,
else
md->attr_list = NULL;
- md->text = g_string_new ("");
+ md->text = g_string_new (NULL);
if (accel_char)
*accel_char = 0;
diff --git a/pango/pangoft2.c b/pango/pangoft2.c
index 4533907f..a77a5a32 100644
--- a/pango/pangoft2.c
+++ b/pango/pangoft2.c
@@ -468,7 +468,10 @@ _pango_ft2_ft_strerror (FT_Error error)
return found->msg;
else
{
- static char default_msg[100];
+ static char *default_msg = NULL;
+
+ if (!default_msg)
+ default_msg = g_malloc (60);
g_sprintf (default_msg, "Unknown FreeType2 error %#x", error);
return default_msg;