From 511b8ed5a686a49c5d0801e33ab240cc89cfb9f2 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Wed, 8 Feb 2006 01:43:59 +0000 Subject: =?UTF-8?q?Bug=20330289=20=E2=80=93=20Fix=20build=20with=20gcc=202?= =?UTF-8?q?.95=20(pangox.c)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 2006-02-07 Behdad Esfahbod Bug 330289 – Fix build with gcc 2.95 (pangox.c) * pango/pangox.c (get_subfonts_foreach): Fixed. --- ChangeLog | 6 ++++++ examples/renderdemo.c | 2 +- examples/viewer-main.c | 14 +++++++------- examples/viewer-pangocairo.c | 12 ++++++------ examples/viewer-pangoft2.c | 25 +++++++++++++++++++------ examples/viewer.h | 26 ++++++++++++++++++++------ pango/pangox.c | 5 ++++- 7 files changed, 63 insertions(+), 27 deletions(-) diff --git a/ChangeLog b/ChangeLog index 61dc8904..c5b9d186 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2006-02-07 Behdad Esfahbod + + Bug 330289 – Fix build with gcc 2.95 (pangox.c) + + * pango/pangox.c (get_subfonts_foreach): Fixed. + 2006-02-07 Tor Lillqvist * examples/viewer-main.c (main): Initialise GError pointer to diff --git a/examples/renderdemo.c b/examples/renderdemo.c index a4bbf3b7..2a157d2b 100644 --- a/examples/renderdemo.c +++ b/examples/renderdemo.c @@ -473,7 +473,7 @@ parse_options (int argc, char *argv[]) {"backend", 0, 0, G_OPTION_ARG_CALLBACK, &parse_backend, "Pango backend to use for rendering", "id"}, {"no-display", 'q', G_OPTION_FLAG_REVERSE, G_OPTION_ARG_NONE, &opt_display, - "Do not display (just save to file or whatever)", NULL}, + "Do not display (just write to file or whatever)", NULL}, {"dpi", 0, 0, G_OPTION_ARG_INT, &opt_dpi, "Set the resolution", "number"}, {"ellipsize", 0, 0, G_OPTION_ARG_CALLBACK, &parse_ellipsis, diff --git a/examples/viewer-main.c b/examples/viewer-main.c index 7823025b..cba50564 100644 --- a/examples/viewer-main.c +++ b/examples/viewer-main.c @@ -62,13 +62,13 @@ main (int argc, if (opt_output) { - if (!view->save) - fail ("%s viewer backend does not support saving", view->name); + if (!view->write) + fail ("%s viewer backend does not support writing", view->name); else { FILE *stream; - if (view->save_suffix && g_str_has_suffix (opt_output, view->save_suffix)) + if (view->write_suffix && g_str_has_suffix (opt_output, view->write_suffix)) { stream = g_fopen (opt_output, "wb"); if (!stream) @@ -91,7 +91,7 @@ main (int argc, fail ("When running ImageMagick 'convert' command: %s\n", error->message); stream = fdopen (fd, "wb"); } - view->save (instance, surface, stream, width, height); + view->write (instance, surface, stream, width, height); fclose (stream); } } @@ -129,8 +129,8 @@ main (int argc, GError *error = NULL; GPid pid; - if (!view->save) - fail ("%s viewer backend does not support displaying or saving", view->name); + if (!view->write) + fail ("%s viewer backend does not support displaying or writing", view->name); display_argv[2] = title; if (!g_spawn_async_with_pipes (NULL, (gchar **)display_argv, NULL, @@ -141,7 +141,7 @@ main (int argc, NULL, NULL, &pid, &fd, NULL, NULL, &error)) fail ("When running ImageMagick 'display' command: %s\n", error->message); stream = fdopen (fd, "wb"); - view->save (instance, surface, stream, width, height); + view->write (instance, surface, stream, width, height); fclose (stream); #ifdef G_OS_UNIX waitpid (pid, NULL, 0); diff --git a/examples/viewer-pangocairo.c b/examples/viewer-pangocairo.c index d2d64e6d..5638ffc9 100644 --- a/examples/viewer-pangocairo.c +++ b/examples/viewer-pangocairo.c @@ -251,11 +251,11 @@ write_func (void *closure, } static void -pangocairo_view_save (gpointer instance, - gpointer surface, - FILE *stream, - int width, - int height) +pangocairo_view_write (gpointer instance, + gpointer surface, + FILE *stream, + int width, + int height) { CairoSurface *c_surface = (CairoSurface *) surface; @@ -314,7 +314,7 @@ const PangoViewer pangocairo_viewer = { pangocairo_view_destroy_surface, pangocairo_view_render, #ifdef HAVE_CAIRO_PNG - pangocairo_view_save, + pangocairo_view_write, #else NULL, #endif diff --git a/examples/viewer-pangoft2.c b/examples/viewer-pangoft2.c index 372ccb30..5daad04b 100644 --- a/examples/viewer-pangoft2.c +++ b/examples/viewer-pangoft2.c @@ -27,6 +27,9 @@ #include "renderdemo.h" #include "viewer.h" +#ifdef HAVE_X +#include "viewer-x.h" +#endif #include @@ -127,11 +130,11 @@ pangoft2_view_render (gpointer instance, } static void -pangoft2_view_save (gpointer instance, - gpointer surface, - FILE *stream, - int width, - int height) +pangoft2_view_write (gpointer instance, + gpointer surface, + FILE *stream, + int width, + int height) { int row; FT_Bitmap *bitmap = (FT_Bitmap *) surface; @@ -155,8 +158,18 @@ const PangoViewer pangoft2_viewer = { pangoft2_view_create_surface, pangoft2_view_destroy_surface, pangoft2_view_render, - pangoft2_view_save, + pangoft2_view_write, + /* +#ifdef HAVE_X + x_view_create_window, + x_view_destroy_window, + pangoft2_x_view_display +#else +*/ NULL, NULL, NULL + /* +#endif +*/ }; diff --git a/examples/viewer.h b/examples/viewer.h index e99d5f9e..4d1d836a 100644 --- a/examples/viewer.h +++ b/examples/viewer.h @@ -32,7 +32,7 @@ struct _PangoViewer { const char *id; - const char *save_suffix; + const char *write_suffix; gpointer (*create) (const PangoViewer *klass); @@ -56,11 +56,11 @@ struct _PangoViewer { /* The following can be NULL */ - void (*save) (gpointer instance, - gpointer surface, - FILE *stream, - int width, - int height); + void (*write) (gpointer instance, + gpointer surface, + FILE *stream, + int width, + int height); gpointer (*create_window) (gpointer instance, const char *title, @@ -77,6 +77,20 @@ struct _PangoViewer { int height, gpointer state); + void (*load) (gpointer instance, + gpointer surface, + guchar *buffer, + int width, + int height, + int stride); + + void (*save) (gpointer instance, + gpointer surface, + guchar *buffer, + int width, + int height, + int stride); + }; extern const PangoViewer *fallback_viewer; diff --git a/pango/pangox.c b/pango/pangox.c index f5fb7dc7..d382df0c 100644 --- a/pango/pangox.c +++ b/pango/pangox.c @@ -876,18 +876,21 @@ get_subfonts_foreach (PangoFont *font, { GSList **subfonts = data; PangoGlyph glyph = glyph_info->glyph; + PangoXSubfont subfont; if (glyph == PANGO_GLYPH_EMPTY) return; /* Use an arbitrary subfont for unknown glyphs...*/ if (glyph & PANGO_GLYPH_UNKNOWN_FLAG) + { if (((PangoXFont *)font)->n_subfonts > 0) glyph = PANGO_X_MAKE_GLYPH (1, 0); else return; + } - PangoXSubfont subfont = PANGO_X_GLYPH_SUBFONT (glyph); + subfont = PANGO_X_GLYPH_SUBFONT (glyph); if (!g_slist_find (*subfonts, GUINT_TO_POINTER ((guint)subfont))) *subfonts = g_slist_prepend (*subfonts, GUINT_TO_POINTER ((guint)subfont)); } -- cgit v1.2.1