From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Sun Yijiang Newsgroups: gmane.emacs.devel Subject: Re: Problem with chinese gbk fonts on w32 Date: Tue, 6 Sep 2005 15:43:14 +0800 Message-ID: <5065e2900509060043650bbe97@mail.gmail.com> References: <5065e29005073119317520578d@mail.gmail.com> <5065e29005080101382635f42d@mail.gmail.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1444304922==" X-Trace: sea.gmane.org 1125993135 10161 80.91.229.2 (6 Sep 2005 07:52:15 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 6 Sep 2005 07:52:15 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Sep 06 09:52:15 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1ECYDX-0002FB-4u for ged-emacs-devel@m.gmane.org; Tue, 06 Sep 2005 09:50:07 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ECYHz-0003o5-2y for ged-emacs-devel@m.gmane.org; Tue, 06 Sep 2005 03:54:43 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1ECYGE-0003fX-1n for emacs-devel@gnu.org; Tue, 06 Sep 2005 03:52:55 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1ECYG4-0003dE-8q for emacs-devel@gnu.org; Tue, 06 Sep 2005 03:52:45 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ECYG2-0003ax-QD for emacs-devel@gnu.org; Tue, 06 Sep 2005 03:52:42 -0400 Original-Received: from [64.233.184.193] (helo=wproxy.gmail.com) by monty-python.gnu.org with esmtp (Exim 4.34) id 1ECYAo-0006YG-QS for emacs-devel@gnu.org; Tue, 06 Sep 2005 03:47:19 -0400 Original-Received: by wproxy.gmail.com with SMTP id i5so1167270wra for ; Tue, 06 Sep 2005 00:43:14 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; b=YwR1YZ9+7YYLUoLWx4N5WIWustLISfYAYX61cHDai/2tSNvIEwSGsTwL5zMc8poGYpEbCm1OzABQotL/5Zw75MKsK9Nlyye0I18rZC2AJnmD69wuBaD8ZQmKNR5R5Z5jc7OuX9+Iahr3lrHhxz/36qi0jU6J8GnGT/rAbMeQUEg= Original-Received: by 10.54.56.77 with SMTP id e77mr4654683wra; Tue, 06 Sep 2005 00:43:14 -0700 (PDT) Original-Received: by 10.54.91.8 with HTTP; Tue, 6 Sep 2005 00:43:14 -0700 (PDT) Original-To: Jason Rumney In-Reply-To: <5065e29005080101382635f42d@mail.gmail.com> X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:42644 Archived-At: --===============1444304922== Content-Type: multipart/alternative; boundary="----=_Part_36163_30840630.1125992594593" ------=_Part_36163_30840630.1125992594593 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline I think I've found the problem, here is the patch of w32fns.c (against=20 revision 1.256). I don't know the detail, but this patch works. --------------------------------------8<-----------------------------------= --- --- w32fns.c 2005-08-08 09:45:47.000000000 +0800 +++ w32fns-fix.c 2005-09-06 15:32:01.275812264 +0800 @@ -4545,7 +4545,7 @@ /* Fill out details in lf according to the font that was actually loaded. */ lf.lfHeight =3D font->tm.tmInternalLeading - font->tm.tmHeight; - lf.lfWidth =3D font->tm.tmMaxCharWidth; + lf.lfWidth =3D font->tm.tmAveCharWidth; lf.lfWeight =3D font->tm.tmWeight; lf.lfItalic =3D font->tm.tmItalic; lf.lfCharSet =3D font->tm.tmCharSet; --------------------------------------8<-----------------------------------= --- 2005/8/1, Sun Yijiang : >=20 > Sorry, I've reviewed my .emacs and found where the problem is. The > problem is NOT mule-gbk, it's "create-fontset-from-fontset-spec". > Following setting results in double-width Chinese characters: >=20 > (create-fontset-from-fontset-spec > "-*-bitstream vera sans mono-normal-r-*-*-14-*-*-*-c-*-fontset-gbk, > chinese-gb2312:-*-simsun-normal-r-normal-*-16-*-*-p-*-gb2312*-*, > chinese-cns11643-5:-*-simsun-normal-r-normal-*-16-*-*-p-*-gbk*-*, > chinese-cns11643-6:-*-simsun-normal-r-normal-*-16-*-*-p-*-gbk*-*, > chinese-cns11643-7:-*-simsun-normal-r-normal-*-16-*-*-p-*-gbk*-*" t) >=20 > I think the problem is that I set different fonts for each char set. If > I comment out this setting and still use mule-gbk, Chinese characters > looks OK. If I use this setting, the Chinese characters looks > double-width, either with or without mule-gbk. This setting works for > previous CVS Emacs builds and seems to become "bad" recently. >=20 > I remember this problem first appeared with a check in of w32bdf.c > early this year. The problem can be resolved by rolling back w32bdf.c > to revision 1.20 at that time. But now even this rolling back does not > work, maybe other changes affects this problem. >=20 >=20 > 2005/8/1, Jason Rumney : > >=20 > > Sun Yijiang writes: > >=20 > > > I think this change is probably not fully tested. When I use the > > > mule-gbk package and set font for chinese characters, they look so=20 > > > wide, but when I use "emacs -q" they look nice, make no difference > > > with previous CVS Emacs. I roll back the src/w32bdf.c to older > > > version, and everything is OK. I think the change of w32bdf.c should > > > be reviewed, since this is really a bug. > >=20 > > You seem to be saying that you only see the "bug" when you load > > mule-gbk, which is not part of Emacs. What does mule-gbk do? Does it > > perhaps try to work around the previous bug by doubling the width of=20 > > Chinese characters? > >=20 > >=20 > ------=_Part_36163_30840630.1125992594593 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline I think I've found the problem, here is the patch of w32fns.c (against revision 1.256). I don't know the detail, but this patch works.

--------------------------------------8<--------------------------------= ------
--- w32fns.c    2005-08-08 09:45:47.000000000 +0800
+++ w32fns-fix.c    2005-09-06 15:32:01.275812264 +0800
@@ -4545,7 +4545,7 @@
         /* Fill out details in lf = according to the font that was
            actually= loaded.  */
         lf.lfHeight =3D font->t= m.tmInternalLeading - font->tm.tmHeight;
-        lf.lfWidth =3D font->tm.tmMa= xCharWidth;
+        lf.lfWidth =3D font->tm.tmAv= eCharWidth;
         lf.lfWeight =3D font->t= m.tmWeight;
         lf.lfItalic =3D font->t= m.tmItalic;
         lf.lfCharSet =3D font->= tm.tmCharSet;
--------------------------------------8<--------------------------------= ------


2005/8/1, Sun Yijiang <sunyijiang@gmail.com>: Sorry, I've reviewed my .emacs and found where the problem is. The
problem is NOT mule-gbk, it's "create-fontset-from-fontset-spec".=
Following setting results in double-width Chinese characters:

(create-fontset-from-fontset-spec
"-*-bitstream vera sans mono-normal-r-*-*-14-*-*-*-c-*-fontset-gbk, chinese-gb2312:-*-simsun-normal-r-normal-*-16-*-*-p-*-gb2312*-*,
chinese-cns11643-5:-*-simsun-normal-r-normal-*-16-*-*-p-*-gbk*-*,
chinese-cns11643-6:-*-simsun-normal-r-normal-*-16-*-*-p-*-gbk*-*,
chinese-cns11643-7:-*-simsun-normal-r-normal-*-16-*-*-p-*-gbk*-*" t)
I think the problem is that I set different fonts for each char set. If
I comment out this setting and still use mule-gbk, Chinese characters
looks OK. If I use this setting, the Chinese characters looks
double-width, either with or without mule-gbk. This setting works for
previous CVS Emacs builds and seems to become "bad" recently.

I remember this problem first appeared with a check in of w32bdf.c
early this year. The problem can be resolved by rolling back w32bdf.c
to revision 1.20 at that time. But now even this rolling back does not
work, maybe other changes affects this problem.


2005/8/1, Jason Rumney <jasonr@gnu.org>:
Sun Yijiang <sunyijiang@gmail.co= m> writes:

> I think this change is probably not fully tes= ted. When I use the
> mule-gbk package and set font for chinese characters, they look so
> wide, but when I use "emacs -q" they look nice, make no = difference
> with previous CVS Emacs. I roll back the src/w32bdf.c to= older
> version, and everything is OK. I think the change of w32bdf.= c should
> be reviewed, since this is really a bug.

You seem to= be saying that you only see the "bug" when you load
mule-gbk,= which is not part of Emacs. What does mule-gbk do? Does it
perhaps try = to work around the previous bug by doubling the width of
Chinese characters?



------=_Part_36163_30840630.1125992594593-- --===============1444304922== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Emacs-devel mailing list Emacs-devel@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-devel --===============1444304922==--