From: Kenichi Handa <handa.kenichi@aist.go.jp>
To: Miles Bader <miles@gnu.org>
Cc: jianzhong.huang@i-soft.com.cn, william.xwl@gmail.com,
emacs-devel@gnu.org
Subject: Re: A patch for enforcing double-width CJK character display
Date: Wed, 18 Apr 2012 15:54:22 +0900 [thread overview]
Message-ID: <tl7liltmswx.fsf@m17n.org> (raw)
In-Reply-To: <buohawk9rg3.fsf@dhlpc061.dev.necel.com> (message from Miles Bader on Mon, 16 Apr 2012 14:27:40 +0900)
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;
}
next prev parent reply other threads:[~2012-04-18 6:54 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 [this message]
2012-04-18 8:13 ` 黄建忠
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=tl7liltmswx.fsf@m17n.org \
--to=handa.kenichi@aist.go.jp \
--cc=emacs-devel@gnu.org \
--cc=jianzhong.huang@i-soft.com.cn \
--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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.