diff options
author | Owen Taylor <otaylor@redhat.com> | 2000-11-14 16:11:02 +0000 |
---|---|---|
committer | Owen Taylor <otaylor@src.gnome.org> | 2000-11-14 16:11:02 +0000 |
commit | e6e7df5c4d77e8e9802cfe615b9265176be1314c (patch) | |
tree | f14288f107b39a331854aacbb3d415428dfa5631 /pango | |
parent | 8c0b3b59674586d069dba895929f23ee6c9ea91b (diff) | |
download | pango-e6e7df5c4d77e8e9802cfe615b9265176be1314c.tar.gz |
Fix low underline code to deal with run_ink == NULL.
Tue Nov 14 11:10:24 2000 Owen Taylor <otaylor@redhat.com>
* pango/pango-layout.c (pango_layout_run_get_extents):
Fix low underline code to deal with run_ink == NULL.
* pango/pango-utils.c (pango_read_line): Return number
of lines read to allow decent parse errors line numbers.
* pango/pangox-fontmap.c (pango_x_font_map_read_alias_file):
Fix line number count.
* examples/pangox.aliases: Include extra international fonts
for all styles, not just roman, reindent so it looks
halfway legible.
Diffstat (limited to 'pango')
-rwxr-xr-x | pango/pango-indic.c | 2 | ||||
-rw-r--r-- | pango/pango-layout.c | 19 | ||||
-rw-r--r-- | pango/pango-utils.c | 11 | ||||
-rw-r--r-- | pango/pango-utils.h | 2 | ||||
-rw-r--r-- | pango/pangox-fontmap.c | 5 | ||||
-rw-r--r-- | pango/pangox.c | 2 | ||||
-rw-r--r-- | pango/pangox.h | 2 |
7 files changed, 28 insertions, 15 deletions
diff --git a/pango/pango-indic.c b/pango/pango-indic.c index e20a4980..5845a035 100755 --- a/pango/pango-indic.c +++ b/pango/pango-indic.c @@ -64,7 +64,7 @@ pango_indic_shift_vowels (PangoIndicScript *script, * @script: A #PangoIndicScript * @num: The number of glyphs * @chars: An array of glyphs/characters - * @clusters: The cluster array. + * @cluster: The cluster array. * * This eliminates any blank space in the @chars * array, updated @clusters and @num also. diff --git a/pango/pango-layout.c b/pango/pango-layout.c index 46ae0231..7f767f83 100644 --- a/pango/pango-layout.c +++ b/pango/pango-layout.c @@ -2868,22 +2868,29 @@ pango_layout_run_get_extents (PangoLayoutRun *run, PangoRectangle shape_ink; PangoRectangle shape_logical; + PangoRectangle tmp_ink; gboolean shape_set; + gboolean need_ink; pango_layout_get_item_properties (run->item, &uline, &shape_ink, &shape_logical, &shape_set); if (shape_setp) *shape_setp = shape_set; + + need_ink = run_ink || uline == PANGO_UNDERLINE_LOW; if (shape_set) imposed_extents (run->item->num_chars, &shape_ink, &shape_logical, - (uline != PANGO_UNDERLINE_NONE) ? run_ink : NULL, run_logical); + need_ink ? &tmp_ink : NULL, run_logical); else pango_glyph_string_extents (run->glyphs, run->item->analysis.font, - (uline != PANGO_UNDERLINE_NONE) ? run_ink : NULL, + need_ink ? &tmp_ink : NULL, run_logical); + if (run_ink) + *run_ink = tmp_ink; + switch (uline) { case PANGO_UNDERLINE_NONE: @@ -2899,12 +2906,12 @@ pango_layout_run_get_extents (PangoLayoutRun *run, run_logical->height = MAX (run_logical->height, 4 * PANGO_SCALE - run_logical->y); break; case PANGO_UNDERLINE_LOW: - if (run_ink) - run_ink->height += 2 * PANGO_SCALE; - /* FIXME: Should this simply be run_logical->height += 2 * PANGO_SCALE instead? */ - run_logical->height = MAX (run_logical->height, run_ink->y + run_ink->height - run_logical->y); + if (run_ink) + run_ink->height += 2 * PANGO_SCALE; + run_logical->height = MAX (run_logical->height, + tmp_ink.y + tmp_ink.height + 2 * PANGO_SCALE - run_logical->y); break; } } diff --git a/pango/pango-utils.c b/pango/pango-utils.c index b8ce0d58..b243f7be 100644 --- a/pango/pango-utils.c +++ b/pango/pango-utils.c @@ -142,14 +142,17 @@ pango_split_file_list (const char *str) * any other character is ignored and written into the output buffer * unmodified. * - * Return value: %FALSE if the stream was already at an EOF character. + * Return value: 0 if the stream was already at an EOF character, otherwise + * the number of lines read (this is useful for maintaining + * a line number counter which doesn't combine lines with \) **/ -gboolean +gint pango_read_line (FILE *stream, GString *str) { gboolean quoted = FALSE; gboolean comment = FALSE; int n_read = 0; + int lines = 1; flockfile (stream); @@ -189,6 +192,8 @@ pango_read_line (FILE *stream, GString *str) (c == '\r' && next_c == '\n') || (c == '\n' && next_c == '\r'))) ungetc (next_c, stream); + + lines++; break; } @@ -230,7 +235,7 @@ pango_read_line (FILE *stream, GString *str) funlockfile (stream); - return n_read > 0; + return (n_read > 0) ? lines : 0; } /** diff --git a/pango/pango-utils.h b/pango/pango-utils.h index 35ef8127..bac20699 100644 --- a/pango/pango-utils.h +++ b/pango/pango-utils.h @@ -26,7 +26,7 @@ char *pango_trim_string (const char *str); char ** pango_split_file_list (const char *str); -gboolean pango_read_line (FILE *stream, +gint pango_read_line (FILE *stream, GString *str); gboolean pango_skip_space (const char **pos); diff --git a/pango/pangox-fontmap.c b/pango/pangox-fontmap.c index 1ea89428..1d0b476c 100644 --- a/pango/pangox-fontmap.c +++ b/pango/pangox-fontmap.c @@ -852,14 +852,15 @@ pango_x_font_map_read_alias_file (PangoXFontMap *xfontmap, { GString *line_buf = g_string_new (NULL); GString *tmp_buf = g_string_new (NULL); + gint lines_read; - while (pango_read_line (infile, line_buf)) + while ((lines_read = pango_read_line (infile, line_buf))) { PangoXFamilyEntry *family_entry; const char *p = line_buf->str; - lineno++; + lineno += lines_read; if (!pango_skip_space (&p)) continue; diff --git a/pango/pangox.c b/pango/pangox.c index 4bf7e7be..fe72da5e 100644 --- a/pango/pangox.c +++ b/pango/pangox.c @@ -1804,7 +1804,7 @@ pango_x_apply_ligatures (PangoFont *font, * @font: A #PangoFont * @rfont: A pointer to a #PangoXSubfont * @charsets: An array of charsets. - * @n_charset: The number of charsets in @charsets. + * @n_charsets: The number of charsets in @charsets. * * Looks for subfonts with the @charset charset, * in @font, and puts the first one in *@rfont diff --git a/pango/pangox.h b/pango/pangox.h index 09171b7e..9a3172fc 100644 --- a/pango/pangox.h +++ b/pango/pangox.h @@ -116,7 +116,7 @@ void pango_x_fallback_shape (PangoFont *font, gboolean pango_x_apply_ligatures (PangoFont *font, PangoXSubfont subfont, - gunichar **chars, + gunichar **glyphs, int *n_glyphs, int **clusters); |