unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: 黄建忠 <jianzhong.huang@i-soft.com.cn>
To: Kenichi Handa <handa.kenichi@aist.go.jp>
Cc: william.xwl@gmail.com, emacs-devel@gnu.org, Miles Bader <miles@gnu.org>
Subject: Re: A patch for enforcing double-width CJK character display
Date: Wed, 18 Apr 2012 16:13:40 +0800	[thread overview]
Message-ID: <4F8E77B4.8030808@i-soft.com.cn> (raw)
In-Reply-To: <tl7liltmswx.fsf@m17n.org>

Not fixed in my OS:

I have the ja "Kiloji" and "VL Gothic" Fonts and zh "YaHei" font
installed in Linux.
And "kiloji" and "VL Gothic" was not added to fontconfig conf files.

1,If the zh fonts exists. no matter whether the ja fonts controlled via
fontconfig conf files or not.
Emacs always try to match zh font first, even under ja_JP.utf8 locale.
But GTK apps will match Japanese font "kiloji" first under ja_JP.utf8.

2,Remove all zh fonts. ja fonts is not controlled via fontconfig conf files.
Emacs will match "kiloji" font first.
All GTK apps also match the "kiloji" font first.

3,Add "VL Gothic" and "kiloji" to fontconfig conf files.
The GTK apps will use "VL Gothic" to display Japanese characters under
ja_JP.utf8.
But Emacs still use "kiloji"

By the way.
CJK font sorting is difficult, since:
1, zh fonts provides almost all ja characters and some basic Korean
letters, we all use "kanji/hanzi" of Chinese.
And lot of "kanji/hanzi" had the same Unicode code.
2, ja fonts provides all ja characters, also some "kanji". some fonts
may provides basic Korean letters.
3, ko fonts may/may not provide "kanji".

That's to say:
1, zh fonts can display ALMOST all ja characters, but not all.
2, ja fonts can display some zh characters, but not all.


Forgive my English writing, hope you can understand:-)



于 2012年04月18日 14:54, Kenichi Handa 写道:
> In article <buohawk9rg3.fsf@dhlpc061.dev.necel.com>, Miles Bader <miles@gnu.org> writes:
>
>> I set the font to "Droid Sans Mono", and the Japanese font Emacs
>> automatically chose was "きろ字".  I don't know _why_ Emacs chose that
>> font,
> That's because I couldn't use FcFontSetSort because it had a
> serious bug when I wrote the relevant code long ago.  Could
> you please try this patch?
>
> ---
> Kenichi Handa
> handa@m17n.org
>
> === modified file 'src/ftfont.c'
> --- src/ftfont.c	2012-03-19 04:08:07 +0000
> +++ src/ftfont.c	2012-04-18 06:44:59 +0000
> @@ -123,6 +123,7 @@
>      { "big5-0", { 0xF6B1 }, "zh-tw" },
>      { "jisx0208.1983-0", { 0x4E55 }, "ja"},
>      { "ksc5601.1985-0", { 0xAC00 }, "ko"},
> +    { "ksc5601.1987-0", { 0xAC00 }, "ko"},
>      { "cns11643.1992-1", { 0xFE32 }, "zh-tw"},
>      { "cns11643.1992-2", { 0x4E33, 0x7934 }},
>      { "cns11643.1992-3", { 0x201A9 }},
> @@ -890,9 +891,10 @@
>    Lisp_Object val = Qnil, family, adstyle;
>    int i;
>    FcPattern *pattern;
> -  FcFontSet *fontset = NULL;
> +  FcFontSet *fontset = NULL, *sorted = NULL;
>    FcObjectSet *objset = NULL;
>    FcCharSet *charset;
> +  FcResult result;
>    Lisp_Object chars = Qnil;
>    char otlayout[15];		/* For "otlayout:XXXX" */
>    struct OpenTypeSpec *otspec = NULL;
> @@ -983,7 +985,12 @@
>  	}
>      }
>  #endif
> -  for (i = 0; i < fontset->nfont; i++)
> +  if (FcConfigSubstitute (NULL, pattern, FcMatchPattern) != FcTrue)
> +    goto err;
> +  FcDefaultSubstitute (pattern);
> +  sorted = FcFontSetSort (NULL, &fontset, 1, pattern, FcFalse, NULL, &result);
> +
> +  for (i = 0; i < sorted->nfont; i++)
>      {
>        Lisp_Object entity;
>  
> @@ -991,7 +998,7 @@
>  	{
>  	  int this;
>  
> -	  if ((FcPatternGetInteger (fontset->fonts[i], FC_SPACING, 0, &this)
> +	  if ((FcPatternGetInteger (sorted->fonts[i], FC_SPACING, 0, &this)
>  	       == FcResultMatch)
>  	      && spacing != this)
>  	    continue;
> @@ -1002,7 +1009,7 @@
>  	{
>  	  FcChar8 *this;
>  
> -	  if (FcPatternGetString (fontset->fonts[i], FC_CAPABILITY, 0, &this)
> +	  if (FcPatternGetString (sorted->fonts[i], FC_CAPABILITY, 0, &this)
>  	      != FcResultMatch
>  	      || ! strstr ((char *) this, otlayout))
>  	    continue;
> @@ -1014,7 +1021,7 @@
>  	  FcChar8 *file;
>  	  OTF *otf;
>  
> -	  if (FcPatternGetString (fontset->fonts[i], FC_FILE, 0, &file)
> +	  if (FcPatternGetString (sorted->fonts[i], FC_FILE, 0, &file)
>  	      != FcResultMatch)
>  	    continue;
>  	  otf = OTF_open ((char *) file);
> @@ -1035,7 +1042,7 @@
>  	{
>  	  int j;
>  
> -	  if (FcPatternGetCharSet (fontset->fonts[i], FC_CHARSET, 0, &charset)
> +	  if (FcPatternGetCharSet (sorted->fonts[i], FC_CHARSET, 0, &charset)
>  	      != FcResultMatch)
>  	    continue;
>  	  for (j = 0; j < ASIZE (chars); j++)
> @@ -1047,7 +1054,7 @@
>  	}
>        if (! NILP (adstyle) || langname)
>  	{
> -	  Lisp_Object this_adstyle = get_adstyle_property (fontset->fonts[i]);
> +	  Lisp_Object this_adstyle = get_adstyle_property (sorted->fonts[i]);
>  
>  	  if (! NILP (adstyle)
>  	      && (NILP (this_adstyle)
> @@ -1059,7 +1066,7 @@
>  	      && xstrcasecmp (langname, SSDATA (SYMBOL_NAME (this_adstyle))))
>  	    continue;
>  	}
> -      entity = ftfont_pattern_entity (fontset->fonts[i],
> +      entity = ftfont_pattern_entity (sorted->fonts[i],
>  				      AREF (spec, FONT_EXTRA_INDEX));
>        if (! NILP (entity))
>  	val = Fcons (entity, val);
> @@ -1076,6 +1083,7 @@
>    FONT_ADD_LOG ("ftfont-list", spec, val);
>    if (objset) FcObjectSetDestroy (objset);
>    if (fontset) FcFontSetDestroy (fontset);
> +  if (sorted) FcFontSetDestroy (sorted);
>    if (pattern) FcPatternDestroy (pattern);
>    return val;
>  }
>
>
>


-- 
Huang JianZhong




  reply	other threads:[~2012-04-18  8:13 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <4F85A138.6090900@i-soft.com.cn>
2012-04-11 15:48 ` A patch for enforcing double-width CJK character display Kan-Ru Chen
2012-04-11 16:16   ` 黄建忠
2012-04-12  8:56     ` 黄建忠
2012-04-12  9:53       ` Eli Zaretskii
2012-04-12 11:18         ` 黄建忠
2012-04-12 14:27           ` Eli Zaretskii
2012-04-12 17:56             ` 黄建忠
2012-04-12 20:33               ` Stefan Monnier
     [not found]                 ` <4F8782C8.2030005@i-soft.com.cn>
2012-04-13 11:42                   ` 黄建忠
2012-04-13 12:03                     ` 黄建忠
2012-04-13 13:27                   ` Stefan Monnier
2012-04-15  5:10                     ` Miles Bader
2012-04-15 13:27                       ` 黄建忠
2012-04-15 16:08                       ` William Xu
2012-04-15 22:19                         ` Miles Bader
2012-04-16  0:51                           ` 黄建忠
2012-04-16  5:27                             ` Miles Bader
2012-04-16  5:40                               ` 黄建忠
2012-04-16  6:37                                 ` 黄建忠
2012-04-16  9:21                                   ` 黄建忠
2012-04-17  2:16                                     ` 黄建忠
2012-04-17  0:13                                   ` Miles Bader
2012-04-17  0:39                                     ` Miles Bader
2012-04-17  2:00                                       ` 黄建忠
2012-04-17  2:30                                         ` Miles Bader
2012-04-17  3:00                                           ` 黄建忠
2012-04-17  4:08                                             ` Miles Bader
2012-04-17  4:56                                               ` Werner LEMBERG
2012-04-17  5:02                                                 ` 黄建忠
2012-04-17  6:33                                                   ` Miles Bader
2012-04-17  7:03                                                   ` Werner LEMBERG
2012-04-17  5:52                                                 ` Miles Bader
2012-04-17  6:10                                                   ` 黄建忠
2012-04-17  7:02                                                     ` Miles Bader
2012-04-17  8:06                                                       ` Werner LEMBERG
2012-04-17  8:25                                                         ` Miles Bader
2012-04-17  9:06                                                           ` Werner LEMBERG
2012-04-17  8:51                                                       ` 黄建忠
2012-04-17  6:45                                                   ` Werner LEMBERG
2012-04-17  9:07                                       ` James Cloos
2012-04-17  9:27                                         ` 黄建忠
2012-04-17  1:47                                     ` 黄建忠
2012-04-18  6:54                               ` Kenichi Handa
2012-04-18  8:13                                 ` 黄建忠 [this message]
2012-04-18 13:58                                 ` Miles Bader
2014-04-28  5:35 JunJie Nan
2014-04-29  5:39 ` Stefan Monnier
2014-04-29  6:36   ` Jan D.
2014-04-29  8:16   ` Thien-Thi Nguyen
2014-04-29 20:41 ` Liang Wang
  -- strict thread matches above, loose matches on Subject: below --
2014-04-30  2:00 Hui Liu
2014-04-30 17:08 ` Liang Wang
2014-10-04  3:26 Feng Shu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4F8E77B4.8030808@i-soft.com.cn \
    --to=jianzhong.huang@i-soft.com.cn \
    --cc=emacs-devel@gnu.org \
    --cc=handa.kenichi@aist.go.jp \
    --cc=miles@gnu.org \
    --cc=william.xwl@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).