FIREFOX的文本框变长问题
忘了是从什么时候开始的了,FF的文本框就变长了,进百度和GOOGLE以及其它有长框的网页进布局就会乱,最烦人的是下面竟然有滚动条,有的时候不滚动还看不全。这两天折腾UBUNTU的时候也发现变长了,去网上看说是一个pango库的问题具体是不是那个问题,不过在UBUNTU上试过装了改过的包之后文本框确实正常了,希望懂得怎么编译的,以及能搞到源码的搞一下,比如JT,haulm。能者且劳
U的帖子:http://forum.ubuntu.org.cn/viewtopic.php?f=77&t=164059&p=1084386#p1084386
[ 本帖最后由 panpanpdj 于 2008-12-19 22:47 编辑 ] 上游BUG 地址:http://bugzilla.gnome.org/show_bug.cgi?id=563356
SVN TRUNK 补丁:http://svn.gnome.org/viewvc/pango?view=revision&revision=2747
3 天前标记的 1.22.4 版本中已经修复。升级理应能够解决。--- trunk/ChangeLog 2008/11/28 17:34:57 2746
+++ trunk/ChangeLog 2008/12/06 01:44:03 2747
@@ -1,3 +1,21 @@
+2008-12-05Behdad Esfahbod<[email protected]>
+
+ 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-28Behdad Esfahbod<[email protected]>
Bug 562574 – Pangocariowin32 is leaking every cairo font it ever
--- trunk/docs/tmpl/fonts.sgml 2008/11/28 17:34:57 2746
+++ trunk/docs/tmpl/fonts.sgml 2008/12/06 01:44:03 2747
@@ -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.
--- trunk/pango/pango-impl-utils.h 2008/11/28 17:34:57 2746
+++ trunk/pango/pango-impl-utils.h 2008/12/06 01:44:03 2747
@@ -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__ */
--- trunk/pango/pangocairo-atsuifont.c 2008/11/28 17:34:57 2746
+++ trunk/pango/pangocairo-atsuifont.c 2008/12/06 01:44:03 2747
@@ -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);
--- trunk/pango/pangocairo-win32font.c 2008/11/28 17:34:57 2746
+++ trunk/pango/pangocairo-win32font.c 2008/12/06 01:44:03 2747
@@ -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);
--- trunk/pango/pangofc-font.c 2008/11/28 17:34:57 2746
+++ trunk/pango/pangofc-font.c 2008/12/06 01:44:03 2747
@@ -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);
nihui写的我还是看不懂,没学过编程,不知做个编译好的包不? MGC的firefox 就是官方版本,点击帮助下拉菜单,检查更新即可更新到firefox的最新版本,呵呵,不过更新后BUG仍存在。 pango更新了,的确消除了BUG,但是我提供的是gcc4更新方案中的
http://ftp.magiclinux.org.cn/haulm/2.1/ 没问题,我的已经是GCC4了 HOHO~~~~~~~~~~~~~~~~~
完事儿了,已经好了,谢了haulm
页:
[1]