QQ登录

只需一步,快速开始

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 2216|回复: 6

FIREFOX的文本框变长问题

[复制链接]
发表于 2008-12-19 22:38:03 | 显示全部楼层 |阅读模式
忘了是从什么时候开始的了,FF的文本框就变长了,进百度和GOOGLE以及其它有长框的网页进布局就会乱,最烦人的是下面竟然有滚动条,有的时候不滚动还看不全。这两天折腾UBUNTU的时候也发现变长了,去网上看说是一个pango库的问题
具体是不是那个问题,不过在UBUNTU上试过装了改过的包之后文本框确实正常了,希望懂得怎么编译的,以及能搞到源码的搞一下,比如JT,haulm。能者且劳
U的帖子:  http://forum.ubuntu.org.cn/viewt ... ;p=1084386#p1084386


[ 本帖最后由 panpanpdj 于 2008-12-19 22:47 编辑 ]

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

×
发表于 2008-12-19 23:21:45 | 显示全部楼层
上游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 版本中已经修复。升级理应能够解决。
  1. --- trunk/ChangeLog        2008/11/28 17:34:57        2746
  2. +++ trunk/ChangeLog        2008/12/06 01:44:03        2747
  3. @@ -1,3 +1,21 @@
  4. +2008-12-05  Behdad Esfahbod  <[email protected]>
  5. +
  6. +        Bug 563356 – The input area of firefox and the blank width after text
  7. +        in gnome-menu was stretched too wide, under pango-1.22.3
  8. +
  9. +        * docs/tmpl/fonts.sgml:
  10. +        * pango/pango-impl-utils.h:
  11. +        * pango/pangocairo-atsuifont.c
  12. +        (pango_cairo_atsui_font_create_metrics_for_context):
  13. +        * pango/pangocairo-win32font.c
  14. +        (pango_cairo_win32_font_create_metrics_for_context):
  15. +        * pango/pangofc-font.c (pango_fc_font_create_metrics_for_context):
  16. +        For approximate_char_width calculation take each char's width into
  17. +        account.  That is, do a weighted average instead of uniform average.
  18. +        g_unichar_iszerowidth() chars count as 0, g_unichar_iswide() chars
  19. +        count 2, and the rest count as 1.  Pretty much wcwidth() behavior.
  20. +        See bug report for rationale.
  21. +
  22. 2008-11-28  Behdad Esfahbod  <[email protected]>

  23.         Bug 562574 – Pangocariowin32 is leaking every cairo font it ever
  24. --- trunk/docs/tmpl/fonts.sgml        2008/11/28 17:34:57        2746
  25. +++ trunk/docs/tmpl/fonts.sgml        2008/12/06 01:44:03        2747
  26. @@ -441,7 +441,10 @@
  27. @descent: the distance from the baseline to the lowest point of the glyphs of
  28.          the font. This is positive in practically all fonts.
  29. @approximate_char_width: approximate average width of the regular glyphs of
  30. -         the font.
  31. +         the font.  Note that for this calculation, East Asian characters
  32. +         (those passing g_unichar_iswide()) are counted as double-width.
  33. +         This produces a more uniform value for this measure across languages
  34. +         and results in more uniform and more expected UI sizes.
  35. @approximate_digit_width: approximate average width of the glyphs for digits
  36.           of the font.
  37. @underline_position: position of the underline. This is normally negative.
  38. --- trunk/pango/pango-impl-utils.h        2008/11/28 17:34:57        2746
  39. +++ trunk/pango/pango-impl-utils.h        2008/12/06 01:44:03        2747
  40. @@ -23,6 +23,7 @@
  41. #ifndef __PANGO_IMPL_UTILS_H__
  42. #define __PANGO_IMPL_UTILS_H__

  43. +#include <glib.h>
  44. #include <glib-object.h>
  45. #include <pango/pango.h>

  46. @@ -92,6 +93,36 @@
  47.                                PangoRectangle   *ink_rect,
  48.                                PangoRectangle   *logical_rect);

  49. +
  50. +/* We define these functions static here because we don't want to add public API
  51. + * for them (if anything, it belongs to glib, but glib found it trivial enough
  52. + * not to add API for).  At some point metrics calculations will be
  53. + * centralized and this mess can be minimized.  Or so I hope.
  54. + */
  55. +
  56. +static inline G_GNUC_UNUSED int
  57. +pango_unichar_width (gunichar c)
  58. +{
  59. +  return G_UNLIKELY (g_unichar_iszerowidth (c)) ? 0 :
  60. +           G_UNLIKELY (g_unichar_iswide (c)) ? 2 : 1;
  61. +}
  62. +
  63. +static G_GNUC_UNUSED glong
  64. +pango_utf8_strwidth (const gchar *p)
  65. +{
  66. +  glong len = 0;
  67. +  g_return_val_if_fail (p != NULL, 0);
  68. +
  69. +  while (*p)
  70. +    {
  71. +      len += pango_unichar_width (g_utf8_get_char (p));
  72. +      p = g_utf8_next_char (p);
  73. +    }
  74. +
  75. +  return len;
  76. +}
  77. +
  78. +
  79. G_END_DECLS

  80. #endif /* __PANGO_IMPL_UTILS_H__ */
  81. --- trunk/pango/pangocairo-atsuifont.c        2008/11/28 17:34:57        2746
  82. +++ trunk/pango/pangocairo-atsuifont.c        2008/12/06 01:44:03        2747
  83. @@ -24,6 +24,7 @@

  84. #import <Cocoa/Cocoa.h>

  85. +#include "pango-impl-utils.h"
  86. #include "pangoatsui-private.h"
  87. #include "pangocairo.h"
  88. #include "pangocairo-private.h"
  89. @@ -148,7 +149,7 @@
  90.    pango_layout_set_text (layout, sample_str, -1);
  91.    pango_layout_get_extents (layout, NULL, &extents);

  92. -  metrics->approximate_char_width = extents.width / g_utf8_strlen (sample_str, -1);
  93. +  metrics->approximate_char_width = extents.width / pango_utf8_strwidth (sample_str);

  94.    pango_layout_set_text (layout, "0123456789", -1);
  95.    metrics->approximate_digit_width = max_glyph_width (layout);
  96. --- trunk/pango/pangocairo-win32font.c        2008/11/28 17:34:57        2746
  97. +++ trunk/pango/pangocairo-win32font.c        2008/12/06 01:44:03        2747
  98. @@ -150,7 +150,7 @@
  99.    pango_layout_set_text (layout, sample_str, -1);
  100.    pango_layout_get_extents (layout, NULL, &extents);

  101. -  metrics->approximate_char_width = extents.width / g_utf8_strlen (sample_str, -1);
  102. +  metrics->approximate_char_width = extents.width / pango_utf8_strwidth (sample_str);

  103.    pango_layout_set_text (layout, "0123456789", -1);
  104.    metrics->approximate_digit_width = max_glyph_width (layout);
  105. --- trunk/pango/pangofc-font.c        2008/11/28 17:34:57        2746
  106. +++ trunk/pango/pangofc-font.c        2008/12/06 01:44:03        2747
  107. @@ -496,7 +496,7 @@
  108.    pango_layout_get_extents (layout, NULL, &extents);

  109.    metrics->approximate_char_width =
  110. -    extents.width / g_utf8_strlen (sample_str, -1);
  111. +    extents.width / pango_utf8_strwidth (sample_str);

  112.    pango_layout_set_text (layout, "0123456789", -1);
  113.    metrics->approximate_digit_width = max_glyph_width (layout);
复制代码
回复

使用道具 举报

 楼主| 发表于 2008-12-19 23:34:25 | 显示全部楼层
nihui写的我还是看不懂,没学过编程,不知做个编译好的包不?
回复

使用道具 举报

发表于 2008-12-20 00:37:53 | 显示全部楼层
MGC的firefox 就是官方版本,点击帮助下拉菜单,检查更新即可更新到firefox的最新版本,呵呵,不过更新后BUG仍存在。
回复

使用道具 举报

发表于 2008-12-20 00:51:38 | 显示全部楼层
pango更新了,的确消除了BUG,但是我提供的是gcc4更新方案中的
http://ftp.magiclinux.org.cn/haulm/2.1/
回复

使用道具 举报

 楼主| 发表于 2008-12-20 14:09:25 | 显示全部楼层
没问题,我的已经是GCC4了
回复

使用道具 举报

 楼主| 发表于 2008-12-20 14:14:22 | 显示全部楼层
HOHO~~~~~~~~~~~~~~~~~
完事儿了,已经好了,谢了haulm

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

×
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

GMT+8, 2024-11-27 05:43 , Processed in 0.047025 second(s), 17 queries .

© 2021 Powered by Discuz! X3.5.

快速回复 返回顶部 返回列表