diff -urN libgnomecanvas-2.30.3/configure libgnomecanvas-2.30.3_ft2_removed/configure --- libgnomecanvas-2.30.3/configure 2011-01-31 05:52:35.000000000 -0800 +++ libgnomecanvas-2.30.3_ft2_removed/configure 2014-01-23 17:25:38.000000000 -0800 @@ -13785,7 +13785,7 @@ -CANVAS_MODULES=" glib-2.0 >= 2.10.0 gtk+-2.0 >= 2.2.0 gail >= 1.9.0 libart-2.0 >= 2.3.8 pango >= 1.0.1 pangoft2 >= 1.0.1" +CANVAS_MODULES=" glib-2.0 >= 2.10.0 gtk+-2.0 >= 2.2.0 gail >= 1.9.0 libart-2.0 >= 2.3.8 pango >= 1.0.1" diff -urN libgnomecanvas-2.30.3/configure.in libgnomecanvas-2.30.3_ft2_removed/configure.in --- libgnomecanvas-2.30.3/configure.in 2011-01-31 05:52:16.000000000 -0800 +++ libgnomecanvas-2.30.3_ft2_removed/configure.in 2014-01-23 17:25:39.000000000 -0800 @@ -87,8 +87,7 @@ gtk+-2.0 >= gtk_required_version dnl gail >= gail_required_version dnl libart-2.0 >= libart_required_version dnl - pango >= pango_required_version dnl - pangoft2 >= pango_required_version" + pango >= pango_required_version" PKG_PROG_PKG_CONFIG([0.18]) PKG_CHECK_MODULES(LIBGNOMECANVAS, $CANVAS_MODULES) diff -urN libgnomecanvas-2.30.3/libgnomecanvas/gnome-canvas-text.c libgnomecanvas-2.30.3_ft2_removed/libgnomecanvas/gnome-canvas-text.c --- libgnomecanvas-2.30.3/libgnomecanvas/gnome-canvas-text.c 2011-01-31 04:19:30.000000000 -0800 +++ libgnomecanvas-2.30.3_ft2_removed/libgnomecanvas/gnome-canvas-text.c 2014-01-23 17:25:51.000000000 -0800 @@ -39,7 +39,13 @@ #include #include #include "gnome-canvas-text.h" -#include + +#define DISABLE_FT2_USE 1 + +#if DISABLE_FT2_USE +#else +#include +#endif #include "libart_lgpl/art_affine.h" #include "libart_lgpl/art_rgb_a_affine.h" @@ -102,7 +108,11 @@ struct _GnomeCanvasTextPrivate { guint render_dirty : 1; +#if DISABLE_FT2_USE + GdkPixbuf * pixbuf; +#else FT_Bitmap bitmap; +#endif }; @@ -545,7 +555,11 @@ text->rise_set = FALSE; text->priv = g_new (GnomeCanvasTextPrivate, 1); +#if DISABLE_FT2_USE + text->priv->pixbuf = NULL; +#else text->priv->bitmap.buffer = NULL; +#endif text->priv->render_dirty = 1; } @@ -581,9 +595,15 @@ g_object_unref (text->stipple); text->stipple = NULL; +#if DISABLE_FT2_USE + if (text->priv && text->priv->pixbuf) { + g_object_unref (text->priv->pixbuf); + } +#else if (text->priv && text->priv->bitmap.buffer) { - g_free (text->priv->bitmap.buffer); + g_free (text->priv->bitmap.buffer); } +#endif g_free (text->priv); text->priv = NULL; @@ -767,6 +787,10 @@ if (!text->layout) { +#if DISABLE_FT2_USE + /* create the layout, without any text specified as of yet (NULL) */ + text->layout = gtk_widget_create_pango_layout(GTK_WIDGET(item->canvas), NULL); +#else PangoContext *gtk_context, *context; gtk_context = gtk_widget_get_pango_context (GTK_WIDGET (item->canvas)); @@ -800,6 +824,7 @@ if (item->canvas->aa) g_object_unref (G_OBJECT (context)); +#endif } switch (param_id) { @@ -1489,6 +1514,11 @@ int src_dx, src_dy; int i, alpha; int bm_rows, bm_width; +#if DISABLE_FT2_USE + int rowstride; + int pitch; + guchar * pixels; +#endif text = GNOME_CANVAS_TEXT (item); @@ -1501,6 +1531,64 @@ bm_rows = (text->clip) ? text->clip_cheight : text->height; bm_width = (text->clip) ? text->clip_cwidth : text->max_width; +#if DISABLE_FT2_USE + if (text->priv->pixbuf != NULL) { + if (bm_rows != gdk_pixbuf_get_height(text->priv->pixbuf) || + bm_width != gdk_pixbuf_get_width(text->priv->pixbuf)) + text->priv->render_dirty=1; + } + + if (text->priv->render_dirty) { + int width, height; + GdkGC * gc; + GdkPixmap * pixmap; + GdkColor white = {0,0xFF00,0xFF00,0xFF00}; + GdkColor black = {0,0,0,0}; + + if (text->priv->pixbuf != NULL) { + g_object_unref(text->priv->pixbuf); + text->priv->pixbuf = NULL; + } + pango_layout_get_pixel_size(text->layout, &width, &height); + + if ((width != 0) && (height != 0)) { + pixmap = gdk_pixmap_new(NULL, width, height, 24); + + /* blank the pixmap */ + gc = gdk_gc_new(pixmap); + gdk_gc_set_rgb_fg_color(gc, &black); + gdk_gc_set_rgb_bg_color(gc, &white); + gdk_draw_rectangle(pixmap, gc, TRUE, 0, 0, width, height); + + + /* reset the fg/bg colors */ + gdk_gc_set_rgb_fg_color(gc, &white); + gdk_gc_set_rgb_bg_color(gc, &black); + + /* What this does is when a clipping rectangle is + being used shift the rendering of the text by the + correct amount so that the correct result is + obtained as if all text was rendered, then clipped. + In this sense we can use smaller buffers and less + rendeirng since hopefully the renderer checks to see + if the glyph falls in the bounding box before + rasterizing it. */ + + if(text->clip) { + render_x = text->cx - text->clip_cx; + render_y = text->cy - text->clip_cy; + } + + gdk_draw_layout(pixmap, gc, render_x, render_y, text->layout); + + text->priv->pixbuf = gdk_pixbuf_get_from_drawable(NULL, pixmap, NULL, 0,0,0,0,width,height); + + g_object_unref(pixmap); + g_object_unref(gc); + } + text->priv->render_dirty = 0; + } +#else if(text->priv->render_dirty || bm_rows != text->priv->bitmap.rows || bm_width != text->priv->bitmap.width) { @@ -1523,6 +1611,7 @@ if the glyph falls in the bounding box before rasterizing it. */ + if(text->clip) { render_x = text->cx - text->clip_cx; render_y = text->cy - text->clip_cy; @@ -1532,6 +1621,7 @@ text->priv->render_dirty = 0; } +#endif if (text->clip) { x = text->clip_cx - buf->rect.x0; @@ -1541,8 +1631,16 @@ y = text->cy - buf->rect.y0; } +#if DISABLE_FT2_USE + if (text->priv->pixbuf != NULL) { + w = gdk_pixbuf_get_width(text->priv->pixbuf); + h = gdk_pixbuf_get_height(text->priv->pixbuf); + } else + w = h = 0; +#else w = text->priv->bitmap.width; h = text->priv->bitmap.rows; +#endif src_dx = src_dy = 0; @@ -1553,7 +1651,7 @@ if (y + h > buf->rect.y1 - buf->rect.y0) { h = buf->rect.y1 - buf->rect.y0 - y; } - + if (x < 0) { w -= - x; src_dx += - x; @@ -1567,6 +1665,28 @@ } dst = buf->buf + y * buf->buf_rowstride + x * 3; +#if DISABLE_FT2_USE + if (text->priv->pixbuf != NULL) { + rowstride = gdk_pixbuf_get_rowstride(text->priv->pixbuf); + pitch = gdk_pixbuf_get_n_channels(text->priv->pixbuf); + pixels = gdk_pixbuf_get_pixels(text->priv->pixbuf); + src = pixels + src_dy * rowstride + src_dx * pitch; + while (h-- > 0) { + i = w; + while (i-- > 0) { + /* FIXME: Do the libart thing instead of divide by 255 */ + /* only using the red channel, as all channels should be the same intensity */ + alpha = ((fg_color & 0xff) * (*src)) / 255; + dst[0] = (dst[0] * (255 - alpha) + ((fg_color >> 24) & 0xff) * alpha) / 255; + dst[1] = (dst[1] * (255 - alpha) + ((fg_color >> 16) & 0xff) * alpha) / 255; + dst[2] = (dst[2] * (255 - alpha) + ((fg_color >> 8) & 0xff) * alpha) / 255; + dst += 3; + src += pitch; + } + dst += buf->buf_rowstride - w*3; + src += rowstride - w*pitch; + } +#else src = text->priv->bitmap.buffer + src_dy * text->priv->bitmap.pitch + src_dx; while (h-- > 0) { @@ -1582,6 +1702,7 @@ } dst += buf->buf_rowstride - w*3; src += text->priv->bitmap.pitch - w; +#endif } buf->is_bg = 0; diff -urN libgnomecanvas-2.30.3/libgnomecanvas/libgnomecanvas-2.0.pc.in libgnomecanvas-2.30.3_fix2/libgnomecanvas/libgnomecanvas-2.0.pc.in --- libgnomecanvas-2.30.3/libgnomecanvas/libgnomecanvas-2.0.pc.in 2011-01-31 04:19:30.000000000 -0800 +++ libgnomecanvas-2.30.3_fix2/libgnomecanvas/libgnomecanvas-2.0.pc.in 2014-01-23 19:35:30.000000000 -0800 @@ -6,7 +6,7 @@ Name: libgnomecanvas-2.0 Description: libgnomecanvas Requires: libart-2.0 gtk+-2.0 -Requires.private: pango pangoft2 gail +Requires.private: pango gail Version: @VERSION@ Libs: -L${libdir} -lgnomecanvas-2 Cflags: -I${includedir}/libgnomecanvas-2.0