From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Kevin Yu" Newsgroups: gmane.emacs.devel Subject: Re: Ntemacs chooses wrong font. Date: Wed, 11 Jun 2008 20:09:43 +0800 Message-ID: <42b562540806110509k597da392xa83823c47958e007@mail.gmail.com> References: <42b562540806060552q622e3dfvb35820ec28dc66d3@mail.gmail.com> <4849AAE4.4080404@gnu.org> <42b562540806061941p2c2d2ebfg734c2d7c4afbbd28@mail.gmail.com> <484F8E81.8050604@gnu.org> <42b562540806110351p699e4ad8l19b5841724eef431@mail.gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_3576_18350040.1213186183624" X-Trace: ger.gmane.org 1213186209 15435 80.91.229.12 (11 Jun 2008 12:10:09 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 11 Jun 2008 12:10:09 +0000 (UTC) Cc: emacs-devel@gnu.org, jasonr@gnu.org To: "Kenichi Handa" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Jun 11 14:10:52 2008 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1K6P9z-0002aP-Ug for ged-emacs-devel@m.gmane.org; Wed, 11 Jun 2008 14:10:40 +0200 Original-Received: from localhost ([127.0.0.1]:33487 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1K6P9C-0002SZ-E0 for ged-emacs-devel@m.gmane.org; Wed, 11 Jun 2008 08:09:50 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1K6P98-0002SH-Jq for emacs-devel@gnu.org; Wed, 11 Jun 2008 08:09:46 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1K6P98-0002S5-1O for emacs-devel@gnu.org; Wed, 11 Jun 2008 08:09:46 -0400 Original-Received: from [199.232.76.173] (port=38778 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1K6P97-0002S2-Ua for emacs-devel@gnu.org; Wed, 11 Jun 2008 08:09:45 -0400 Original-Received: from ti-out-0910.google.com ([209.85.142.186]:62653) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1K6P96-0005xj-Tg for emacs-devel@gnu.org; Wed, 11 Jun 2008 08:09:45 -0400 Original-Received: by ti-out-0910.google.com with SMTP id u5so851441tia.10 for ; Wed, 11 Jun 2008 05:09:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:cc:in-reply-to:mime-version:content-type:references; bh=q3SzYaJxX8WIamIiRgNYrIidlMSbUZuethDLPj+/27Y=; b=EgRP08HfYOPp4iYrEkWVXmvStRexIbiVlz651OAelpGn70oOU1NwTQYFS+AD0cwB9U 81ZQR86p73gSisk3sHSwq/DBBWpzfmGN5u1gmv7SSHPWPNtsTILY9aFt5HhuyV1zgErV xqtay0TtAmT3An9G8kZQmPTY/44kViLxavYmY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version :content-type:references; b=qGVxABHG6rFOEEeJXSdJqQWS2MfIuKKPa6rKBVdMVX5rHTJuDoBqiwYhOAliDC9hg7 V5Gx4RPR45c7zru1KMjkZndySSRfTYoogbkVP2N/+xtANyCj16mkUzDtzVlmd7M2kz1P tAL8UeupHM3twuw/Ql80EeszAomVWo4DnuXu4= Original-Received: by 10.110.33.15 with SMTP id g15mr1383527tig.54.1213186183647; Wed, 11 Jun 2008 05:09:43 -0700 (PDT) Original-Received: by 10.110.5.9 with HTTP; Wed, 11 Jun 2008 05:09:43 -0700 (PDT) In-Reply-To: X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 2) 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:98944 Archived-At: ------=_Part_3576_18350040.1213186183624 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline On Wed, Jun 11, 2008 at 7:50 PM, Kenichi Handa wrote: > In article <42b562540806110351p699e4ad8l19b5841724eef431@mail.gmail.com>, > "Kevin Yu" writes: > > > > > Emacs displays the font family name as:"\320\302\313\316\314\345" > > > > > > This is a bug, but it should at least be consistent, as there is no > > > encoding in either direction. > > I currently explicitly generate a unibyte string for font > names just to avoid the font name encoding problem until the > font-backend codes gets stable. > > > > Here's my font related configuration > > > (set-language-environment "chinese-gb18030") > > (set-frame-font "Monaco-10") > > (set-fontset-font (frame-parameter nil 'font) > > 'han '("Microsoft Yahei"."unicode-bmp")) > > (set-fontset-font (frame-parameter nil 'font) > > 'symbol '("Microsoft Yahei"."unicode-bmp")) > > (set-fontset-font (frame-parameter nil 'font) > > 'cjk-misc '("Microsoft Yahei"."unicode-bmp")) > > (set-fontset-font (frame-parameter nil 'font) > > 'bopomofo '("Microsoft Yahei"."unicode-bmp")) > > Emacs at first checks if a charater is supported by the > frame font (here "Monaco-10") to avoid unnecessary looking > up of fontset table . If supported, the frame font is used. > And, in your case, the font backend on Windows says that the > frame font supports it. That is the problem. Why does the backend say the frame font support the Chinese charset? Is it a bug of Windows font backend or a bug of "Monaco" font? I have tried to use "Courier New", but emacs can't choose the right font for Chinese either. > > > > if I open a existed file with Chinese characters, everything goes well. > > It seems that you saved the file with some of legacy > encoding (e.g. euc-cn, big5). On reading such a file, Emacs > adds a charset text-property (e.g. chinese-gb2312, big5), > and if a character has such a property, Emacs doesn't try > the frame font, but does a normal fontset looking up > (because `charset' information may change the priority of > fonts). So, your fontset setting above takes effect. > > Perhaps, we should not try the frame font for a certain > group of charcters (e.g. han, indic, ??). > > --- > Kenichi Handa > handa@ni.aist.go.jp > ------=_Part_3576_18350040.1213186183624 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline

On Wed, Jun 11, 2008 at 7:50 PM, Kenichi Handa <handa@m17n.org> wrote:
In article <42b562540806110351p699e4ad8l19b5841724eef431@mail.gmail.com>, "Kevin Yu" <yujie052@gmail.com> writes:

> > > Emacs displays the font family name as:"\320\302\313\316\314\345"
> >
> > This is a bug, but it should at least be consistent, as there is no
> > encoding in either direction.

I currently explicitly generate a unibyte string for font
names just to avoid the font name encoding problem until the
font-backend codes gets stable.


> Here's my font related configuration

> (set-language-environment "chinese-gb18030")
> (set-frame-font "Monaco-10")
> (set-fontset-font (frame-parameter nil 'font)
>           'han '("Microsoft Yahei"."unicode-bmp"))
> (set-fontset-font (frame-parameter nil 'font)
>           'symbol '("Microsoft Yahei"."unicode-bmp"))
> (set-fontset-font (frame-parameter nil 'font)
>           'cjk-misc '("Microsoft Yahei"."unicode-bmp"))
> (set-fontset-font (frame-parameter nil 'font)
>           'bopomofo '("Microsoft Yahei"."unicode-bmp"))

Emacs at first checks if a charater is supported by the
frame font (here "Monaco-10") to avoid unnecessary looking
up of fontset table .  If supported, the frame font is used.
And, in your case, the font backend on Windows says that the
frame font supports it.  That is the problem.
Why does the backend say the frame font support the Chinese charset?
Is it a bug of Windows font backend or a bug of "Monaco" font?
I have tried to use "Courier New", but emacs can't choose the right font for Chinese either.
 


> if I open a existed file with Chinese characters, everything goes well.

It seems that you saved the file with some of legacy
encoding (e.g. euc-cn, big5).  On reading such a file, Emacs
adds a charset text-property (e.g. chinese-gb2312, big5),
and if a character has such a property, Emacs doesn't try
the frame font, but does a normal fontset looking up
(because `charset' information may change the priority of
fonts).  So, your fontset setting above takes effect.

Perhaps, we should not try the frame font for a certain
group of charcters (e.g. han, indic, ??).

---
Kenichi Handa
handa@ni.aist.go.jp

------=_Part_3576_18350040.1213186183624--