[arch-commits] Commit in pango/trunk (PKGBUILD bgo563356.patch)
Jan de Groot
jgc at archlinux.org
Sat Dec 6 09:49:55 UTC 2008
Date: Saturday, December 6, 2008 @ 04:49:55
Author: jgc
Revision: 20671
upgpkg: pango 1.22.3-2
Fix http://bugs.gnome.org/563356 (FS#11590)
Added:
pango/trunk/bgo563356.patch
Modified:
pango/trunk/PKGBUILD
-----------------+
PKGBUILD | 8 -
bgo563356.patch | 305 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 310 insertions(+), 3 deletions(-)
Modified: PKGBUILD
===================================================================
--- PKGBUILD 2008-12-06 09:19:19 UTC (rev 20670)
+++ PKGBUILD 2008-12-06 09:49:55 UTC (rev 20671)
@@ -3,7 +3,7 @@
pkgname=pango
pkgver=1.22.3
-pkgrel=1
+pkgrel=2
pkgdesc="A library for layout and rendering of text"
arch=(i686 x86_64)
license=('LGPL')
@@ -11,12 +11,14 @@
makedepends=('pkgconfig' 'libxt')
options=('!libtool' '!emptydirs')
install=pango.install
-source=(http://ftp.gnome.org/pub/gnome/sources/${pkgname}/1.22/${pkgname}-${pkgver}.tar.bz2)
+source=(http://ftp.gnome.org/pub/gnome/sources/${pkgname}/1.22/${pkgname}-${pkgver}.tar.bz2
+ bgo563356.patch)
url="http://www.pango.org/"
-md5sums=('8909ddbde2f2e91eb0c79202e1051a84')
+md5sums=('8909ddbde2f2e91eb0c79202e1051a84' '1fa869245c08672364498322777abc7d')
build() {
cd "${srcdir}/${pkgname}-${pkgver}"
+ patch -Np1 -i "${srcdir}/bgo563356.patch" || return 1
./configure --prefix=/usr --sysconfdir=/etc \
--localstatedir=/var || return 1
make || return 1
Added: bgo563356.patch
===================================================================
--- bgo563356.patch (rev 0)
+++ bgo563356.patch 2008-12-06 09:49:55 UTC (rev 20671)
@@ -0,0 +1,305 @@
+diff -aur old/ChangeLog new/ChangeLog
+--- old/ChangeLog 2008-12-06 14:35:33.037390818 +0800
++++ new/ChangeLog 2008-12-06 14:35:11.475339336 +0800
+@@ -1,3 +1,39 @@
++2008-12-05 Behdad Esfahbod <behdad at gnome.org>
++
++ Bug 563356 – The input area of firefox and the blank width after text
++ in gnome-menu was stretched too wide, under pango-1.22.3
++
++ * docs/tmpl/fonts.sgml:
++ * pango/pango-impl-utils.h:
++ * pango/pangocairo-atsuifont.c
++ (pango_cairo_atsui_font_create_metrics_for_context):
++ * pango/pangocairo-win32font.c
++ (pango_cairo_win32_font_create_metrics_for_context):
++ * pango/pangofc-font.c (pango_fc_font_create_metrics_for_context):
++ For approximate_char_width calculation take each char's width into
++ account. That is, do a weighted average instead of uniform average.
++ g_unichar_iszerowidth() chars count as 0, g_unichar_iswide() chars
++ count 2, and the rest count as 1. Pretty much wcwidth() behavior.
++ See bug report for rationale.
++
++2008-11-28 Behdad Esfahbod <behdad at gnome.org>
++
++ Bug 562574 – Pangocariowin32 is leaking every cairo font it ever
++ creates
++
++ * pango/pangocairo-atsuifont.c (pango_cairo_atsui_font_finalize):
++ * pango/pangocairo-win32font.c (pango_cairo_win32_font_finalize):
++ Finalize shared pangocairo font resources. Oops!
++
++ * pango/pangocairo-font.c (_pango_cairo_font_private_finalize):
++ Protect against multiple calls to finalize. This is practiced by the
++ pangocairo-fcfont when a font is shutdown and then finalized.
++
++2008-11-26 Behdad Esfahbod <behdad at gnome.org>
++
++ * examples/cairotwisted.c (parametrize_path), (point_on_path):
++ Handle close_path correctly.
++
+ 2008-11-23 Behdad Esfahbod <behdad at gnome.org>
+
+ * === Released 1.22.3 ===
+diff -aur old/docs/tmpl/fonts.sgml new/docs/tmpl/fonts.sgml
+--- old/docs/tmpl/fonts.sgml 2008-12-06 14:35:11.450807479 +0800
++++ new/docs/tmpl/fonts.sgml 2008-12-06 14:34:53.771786070 +0800
+@@ -441,7 +441,10 @@
+ @descent: the distance from the baseline to the lowest point of the glyphs of
+ the font. This is positive in practically all fonts.
+ @approximate_char_width: approximate average width of the regular glyphs of
+- the font.
++ the font. Note that for this calculation, East Asian characters
++ (those passing g_unichar_iswide()) are counted as double-width.
++ This produces a more uniform value for this measure across languages
++ and results in more uniform and more expected UI sizes.
+ @approximate_digit_width: approximate average width of the glyphs for digits
+ of the font.
+ @underline_position: position of the underline. This is normally negative.
+diff -aur old/examples/cairotwisted.c new/examples/cairotwisted.c
+--- old/examples/cairotwisted.c 2008-12-06 14:35:32.900725834 +0800
++++ new/examples/cairotwisted.c 2008-12-06 14:35:11.264059243 +0800
+@@ -216,7 +216,7 @@
+ parametrize_path (cairo_path_t *path)
+ {
+ int i;
+- cairo_path_data_t *data, current_point;
++ cairo_path_data_t *data, last_move_to, current_point;
+ parametrization_t *parametrization;
+
+ parametrization = malloc (path->num_data * sizeof (parametrization[0]));
+@@ -226,8 +226,13 @@
+ parametrization[i] = 0.0;
+ switch (data->header.type) {
+ case CAIRO_PATH_MOVE_TO:
++ last_move_to = data[1];
+ current_point = data[1];
+ break;
++ case CAIRO_PATH_CLOSE_PATH:
++ /* Make it look like it's a line_to to last_move_to */
++ data = (&last_move_to) - 1;
++ /* fall through */
+ case CAIRO_PATH_LINE_TO:
+ parametrization[i] = two_points_distance (¤t_point, &data[1]);
+ current_point = data[1];
+@@ -245,8 +250,6 @@
+
+ current_point = data[3];
+ break;
+- case CAIRO_PATH_CLOSE_PATH:
+- break;
+ default:
+ g_assert_not_reached ();
+ }
+@@ -320,7 +323,7 @@
+ {
+ int i;
+ double ratio, the_y = *y, the_x = *x, dx, dy;
+- cairo_path_data_t *data, current_point;
++ cairo_path_data_t *data, last_move_to, current_point;
+ cairo_path_t *path = param->path;
+ parametrization_t *parametrization = param->parametrization;
+
+@@ -333,6 +336,7 @@
+ switch (data->header.type) {
+ case CAIRO_PATH_MOVE_TO:
+ current_point = data[1];
++ last_move_to = data[1];
+ break;
+ case CAIRO_PATH_LINE_TO:
+ current_point = data[1];
+@@ -352,6 +356,10 @@
+
+ case CAIRO_PATH_MOVE_TO:
+ break;
++ case CAIRO_PATH_CLOSE_PATH:
++ /* Make it look like it's a line_to to last_move_to */
++ data = (&last_move_to) - 1;
++ /* fall through */
+ case CAIRO_PATH_LINE_TO:
+ {
+ ratio = the_x / parametrization[i];
+@@ -424,8 +432,6 @@
+ *y += dx * ratio;
+ }
+ break;
+- case CAIRO_PATH_CLOSE_PATH:
+- break;
+ default:
+ g_assert_not_reached ();
+ }
+diff -aur old/pango/pango-impl-utils.h new/pango/pango-impl-utils.h
+--- old/pango/pango-impl-utils.h 2008-12-06 14:35:22.291559359 +0800
++++ new/pango/pango-impl-utils.h 2008-12-06 14:35:03.550729660 +0800
+@@ -23,6 +23,7 @@
+ #ifndef __PANGO_IMPL_UTILS_H__
+ #define __PANGO_IMPL_UTILS_H__
+
++#include <glib.h>
+ #include <glib-object.h>
+ #include <pango/pango.h>
+
+@@ -92,6 +93,36 @@
+ PangoRectangle *ink_rect,
+ PangoRectangle *logical_rect);
+
++
++/* We define these functions static here because we don't want to add public API
++ * for them (if anything, it belongs to glib, but glib found it trivial enough
++ * not to add API for). At some point metrics calculations will be
++ * centralized and this mess can be minimized. Or so I hope.
++ */
++
++static inline G_GNUC_UNUSED int
++pango_unichar_width (gunichar c)
++{
++ return G_UNLIKELY (g_unichar_iszerowidth (c)) ? 0 :
++ G_UNLIKELY (g_unichar_iswide (c)) ? 2 : 1;
++}
++
++static G_GNUC_UNUSED glong
++pango_utf8_strwidth (const gchar *p)
++{
++ glong len = 0;
++ g_return_val_if_fail (p != NULL, 0);
++
++ while (*p)
++ {
++ len += pango_unichar_width (g_utf8_get_char (p));
++ p = g_utf8_next_char (p);
++ }
++
++ return len;
++}
++
++
+ G_END_DECLS
+
+ #endif /* __PANGO_IMPL_UTILS_H__ */
+diff -aur old/pango/pangocairo-atsuifont.c new/pango/pangocairo-atsuifont.c
+--- old/pango/pangocairo-atsuifont.c 2008-12-06 14:35:23.464057615 +0800
++++ new/pango/pangocairo-atsuifont.c 2008-12-06 14:35:04.914061436 +0800
+@@ -24,6 +24,7 @@
+
+ #import <Cocoa/Cocoa.h>
+
++#include "pango-impl-utils.h"
+ #include "pangoatsui-private.h"
+ #include "pangocairo.h"
+ #include "pangocairo-private.h"
+@@ -148,7 +149,7 @@
+ pango_layout_set_text (layout, sample_str, -1);
+ pango_layout_get_extents (layout, NULL, &extents);
+
+- metrics->approximate_char_width = extents.width / g_utf8_strlen (sample_str, -1);
++ metrics->approximate_char_width = extents.width / pango_utf8_strwidth (sample_str);
+
+ pango_layout_set_text (layout, "0123456789", -1);
+ metrics->approximate_digit_width = max_glyph_width (layout);
+@@ -174,6 +175,10 @@
+ static void
+ pango_cairo_atsui_font_finalize (GObject *object)
+ {
++ PangoCairoATSUIFont *cafont = (PangoCairoATSUIFont *) object;
++
++ _pango_cairo_font_private_finalize (&cafont->cf_priv);
++
+ G_OBJECT_CLASS (pango_cairo_atsui_font_parent_class)->finalize (object);
+ }
+
+@@ -191,7 +196,7 @@
+ }
+
+ static void
+-pango_cairo_atsui_font_init (PangoCairoATSUIFont *cafont)
++pango_cairo_atsui_font_init (PangoCairoATSUIFont *cafont G_GNUC_UNUSED)
+ {
+ }
+
+diff -aur old/pango/pangocairo-fcfont.c new/pango/pangocairo-fcfont.c
+--- old/pango/pangocairo-fcfont.c 2008-12-06 14:35:22.840724772 +0800
++++ new/pango/pangocairo-fcfont.c 2008-12-06 14:35:04.294060844 +0800
+@@ -88,7 +88,7 @@
+ static void
+ pango_cairo_fc_font_finalize (GObject *object)
+ {
+- PangoCairoFcFont *cffont = (PangoCairoFcFont *) (object);
++ PangoCairoFcFont *cffont = (PangoCairoFcFont *) object;
+
+ _pango_cairo_font_private_finalize (&cffont->cf_priv);
+
+@@ -162,7 +162,7 @@
+ }
+
+ static void
+-pango_cairo_fc_font_init (PangoCairoFcFont *cffont)
++pango_cairo_fc_font_init (PangoCairoFcFont *cffont G_GNUC_UNUSED)
+ {
+ }
+
+diff -aur old/pango/pangocairo-font.c new/pango/pangocairo-font.c
+--- old/pango/pangocairo-font.c 2008-12-06 14:35:23.387391067 +0800
++++ new/pango/pangocairo-font.c 2008-12-06 14:35:04.840728398 +0800
+@@ -560,14 +560,18 @@
+
+ if (cf_priv->scaled_font)
+ cairo_scaled_font_destroy (cf_priv->scaled_font);
++ cf_priv->scaled_font = NULL;
+
+ _pango_cairo_font_hex_box_info_destroy (cf_priv->hbi);
++ cf_priv->hbi = NULL;
+
+ if (cf_priv->glyph_extents_cache)
+ g_free (cf_priv->glyph_extents_cache);
++ cf_priv->glyph_extents_cache = NULL;
+
+ g_slist_foreach (cf_priv->metrics_by_lang, (GFunc)free_metrics_info, NULL);
+ g_slist_free (cf_priv->metrics_by_lang);
++ cf_priv->metrics_by_lang = NULL;
+ }
+
+ gboolean
+diff -aur old/pango/pangocairo-win32font.c new/pango/pangocairo-win32font.c
+--- old/pango/pangocairo-win32font.c 2008-12-06 14:35:22.500726273 +0800
++++ new/pango/pangocairo-win32font.c 2008-12-06 14:35:03.990726207 +0800
+@@ -150,7 +150,7 @@
+ pango_layout_set_text (layout, sample_str, -1);
+ pango_layout_get_extents (layout, NULL, &extents);
+
+- metrics->approximate_char_width = extents.width / g_utf8_strlen (sample_str, -1);
++ metrics->approximate_char_width = extents.width / pango_utf8_strwidth (sample_str);
+
+ pango_layout_set_text (layout, "0123456789", -1);
+ metrics->approximate_digit_width = max_glyph_width (layout);
+@@ -164,6 +164,10 @@
+ static void
+ pango_cairo_win32_font_finalize (GObject *object)
+ {
++ PangoCairoWin32Font *cwfont = (PangoCairoWin32Font *) object;
++
++ _pango_cairo_font_private_finalize (&cwfont->cf_priv);
++
+ G_OBJECT_CLASS (pango_cairo_win32_font_parent_class)->finalize (object);
+ }
+
+@@ -225,7 +229,7 @@
+ }
+
+ static void
+-pango_cairo_win32_font_init (PangoCairoWin32Font *cwfont)
++pango_cairo_win32_font_init (PangoCairoWin32Font *cwfont G_GNUC_UNUSED)
+ {
+ }
+
+diff -aur old/pango/pangofc-font.c new/pango/pangofc-font.c
+--- old/pango/pangofc-font.c 2008-12-06 14:35:23.117390557 +0800
++++ new/pango/pangofc-font.c 2008-12-06 14:35:04.564059609 +0800
+@@ -496,7 +496,7 @@
+ pango_layout_get_extents (layout, NULL, &extents);
+
+ metrics->approximate_char_width =
+- extents.width / g_utf8_strlen (sample_str, -1);
++ extents.width / pango_utf8_strwidth (sample_str);
+
+ pango_layout_set_text (layout, "0123456789", -1);
+ metrics->approximate_digit_width = max_glyph_width (layout);
More information about the arch-commits
mailing list