diff options
author | Ramiro Estrugo <ramiro@src.gnome.org> | 2000-09-04 15:05:39 +0000 |
---|---|---|
committer | Ramiro Estrugo <ramiro@src.gnome.org> | 2000-09-04 15:05:39 +0000 |
commit | 93861b3494f85f749a1d3bcc2225720989ca61a5 (patch) | |
tree | b3b6bc6c83c9767f4f94b3236b39d9abfe94e3aa /librsvg | |
parent | 31cb07f67aeff1c10fb4ebce4fb80b24f566b06c (diff) | |
download | nautilus-93861b3494f85f749a1d3bcc2225720989ca61a5.tar.gz |
Work on task 1588.
* libnautilus-extensions/nautilus-scalable-font.c:
(nautilus_scalable_font_measure_text),
(nautilus_scalable_font_draw_text),
(nautilus_scalable_font_measure_text_lines),
(nautilus_scalable_font_draw_text_lines),
(nautilus_scalable_font_measure_text_lines),
(nautilus_scalable_font_draw_text_lines),
(nautilus_scalable_font_largest_fitting_font_size):
* libnautilus-extensions/nautilus-scalable-font.h:
Change api to accept a string with embedded new lines instead of
an array of strings. This simplifies many things.
* libnautilus-extensions/nautilus-label.c:
(nautilus_label_initialize), (nautilus_label_destroy),
(render_buffer_pixbuf), (label_recompute_line_geometries):
Update for NautilusScalalbleFont api changes. No longer need to
tokenize the text string. we can feed the string to the rendering
api as is.
* librsvg/rsvg-ft.c: (rsvg_ft_render_string):
* librsvg/rsvg-ft.h:
Change the string to glyph rendering api to accept the string
length rather than computing it. This makes it possible to feed
it arbitrary lengths.
* librsvg/rsvg.c: (rsvg_text_handler_characters):
* librsvg/test-ft-gtk.c: (draw_line):
* librsvg/test-ft.c: (main):
Update for api changes.
* src/nautilus-about.c: (draw_aa_string):
* src/nautilus-sidebar-tabs.c: (draw_one_tab_plain),
(draw_one_tab_themed), (get_tab_width):
* test/test-nautilus-font.c: (main):
Update test to use text lines drawing api.
* test/test-nautilus-label.c:
(alpha_background_color_value_changed_callback), (main):
Update test for 2 new lines in a row.
Diffstat (limited to 'librsvg')
-rw-r--r-- | librsvg/rsvg-ft.c | 15 | ||||
-rw-r--r-- | librsvg/rsvg-ft.h | 4 | ||||
-rw-r--r-- | librsvg/rsvg.c | 4 | ||||
-rw-r--r-- | librsvg/test-ft-gtk.c | 1 | ||||
-rw-r--r-- | librsvg/test-ft.c | 1 |
5 files changed, 18 insertions, 7 deletions
diff --git a/librsvg/rsvg-ft.c b/librsvg/rsvg-ft.c index 214fc4bda..c035b71db 100644 --- a/librsvg/rsvg-ft.c +++ b/librsvg/rsvg-ft.c @@ -618,12 +618,13 @@ rsvg_ft_get_glyph_cached (RsvgFTCtx *ctx, RsvgFTFontHandle fh, **/ RsvgFTGlyph * rsvg_ft_render_string (RsvgFTCtx *ctx, RsvgFTFontHandle fh, - const char *str, double sx, double sy, + const char *str, + unsigned int length, + double sx, double sy, const double affine[6], int xy[2]) { RsvgFTFont *font; RsvgFTGlyph *result; - const int len = strlen (str); RsvgFTGlyph **glyphs; int *glyph_xy; int i, j; @@ -636,14 +637,18 @@ rsvg_ft_render_string (RsvgFTCtx *ctx, RsvgFTFontHandle fh, int n_glyphs; double init_x, init_y; + g_return_val_if_fail (ctx != NULL, NULL); + g_return_val_if_fail (str != NULL, NULL); + g_return_val_if_fail (length <= strlen (str), NULL); + font = rsvg_ft_font_resolve (ctx, fh); if (font == NULL) return NULL; bbox.x0 = bbox.x1 = 0; - glyphs = g_new (RsvgFTGlyph *, len); - glyph_xy = g_new (int, len * 2); + glyphs = g_new (RsvgFTGlyph *, length); + glyph_xy = g_new (int, length * 2); for (j = 0; j < 6; j++) glyph_affine[j] = affine[j]; @@ -651,7 +656,7 @@ rsvg_ft_render_string (RsvgFTCtx *ctx, RsvgFTFontHandle fh, init_x = affine[4]; init_y = affine[5]; n_glyphs = 0; - for (i = 0; i < len; i++) { + for (i = 0; i < length; i++) { RsvgFTGlyph *glyph; glyph_index = FT_Get_Char_Index (font->face, diff --git a/librsvg/rsvg-ft.h b/librsvg/rsvg-ft.h index 693c949a6..69b441eb8 100644 --- a/librsvg/rsvg-ft.h +++ b/librsvg/rsvg-ft.h @@ -34,7 +34,9 @@ rsvg_ft_font_unref (RsvgFTFont *font); RsvgFTGlyph * rsvg_ft_render_string (RsvgFTCtx *ctx, RsvgFTFontHandle fh, - const char *str, double sx, double sy, + const char *str, + unsigned int length, + double sx, double sy, const double affine[6], int xy[2]); void diff --git a/librsvg/rsvg.c b/librsvg/rsvg.c index 8582e94a1..c00eab4c6 100644 --- a/librsvg/rsvg.c +++ b/librsvg/rsvg.c @@ -803,7 +803,9 @@ rsvg_text_handler_characters (RsvgSaxHandler *self, const xmlChar *ch, int len) has_alpha ? ART_ALPHA_SEPARATE : ART_ALPHA_NONE, NULL); - glyph = rsvg_ft_render_string (ctx->ft_ctx, fh, string, + glyph = rsvg_ft_render_string (ctx->ft_ctx, fh, + string, + strlen (string), state->font_size, state->font_size, state->affine, glyph_xy); diff --git a/librsvg/test-ft-gtk.c b/librsvg/test-ft-gtk.c index 5268b8cfb..ce907afe6 100644 --- a/librsvg/test-ft-gtk.c +++ b/librsvg/test-ft-gtk.c @@ -132,6 +132,7 @@ static void draw_line (TestCtx *ctx, int line_num, ArtIRect *rect) glyph = rsvg_ft_render_string (ctx->ctx, ctx->fh, ctx->lines[line_num], + strlen (ctx->lines[line_num]), 14, 14, affine, glyph_xy); diff --git a/librsvg/test-ft.c b/librsvg/test-ft.c index 3401d4c8a..d21eadcf5 100644 --- a/librsvg/test-ft.c +++ b/librsvg/test-ft.c @@ -377,6 +377,7 @@ int main(int argc, char **argv) glyph = rsvg_ft_render_string (ctx, fh, "graphic(s)", + strlen ("graphic(s)"), font_width, font_height, affine, |