* set-fontset-font and preferred charset?
@ 2009-07-03 5:15 Yoshiaki Kasahara
2009-07-03 5:53 ` Kenichi Handa
0 siblings, 1 reply; 23+ messages in thread
From: Yoshiaki Kasahara @ 2009-07-03 5:15 UTC (permalink / raw)
To: emacs-devel
Hello,
Is there any way to specify different fonts for the same character
with different preferred charsets?
For example, I want to display cyrillic/greek characters using
jisx0208.1983 fonts (wide characters) in Japanese charset texts, and
iso8859-* fonts (narrow characters) in other context (such as email
from other countries).
In other word, how can I specify different fonts for the following two
characters?
-----------
character: д (1076, #o2064, #x434)
preferred charset: cyrillic-iso8859-5
(Right-Hand Part of ISO/IEC 8859/5 (Latin/Cyrillic): ISO-IR-144)
code point: 0x54
syntax: w which means: word
category:
.:Base, Y:2-byte Cyrillic, c:Chinese, h:Korean, j:Japanese, y:Cyrillic
buffer code: #xD0 #xB4
file code: ESC #x2C #x4C #x54 (encoded by coding system iso-2022-7bit)
display: by this font (glyph code)
x:-misc-fixed-medium-r-normal--14-130-75-75-c-70-iso8859-5 (#xD4)
Character code properties: customize what to show
name: CYRILLIC SMALL LETTER DE
general-category: Ll (Letter, Lowercase)
canonical-combining-class: 0 (Spacing, split, enclosing, reordrant, and Tibetan subjoined)
bidi-class: L (Left-to-Right)
mirrored: N
uppercase: 1044 (Д)
titlecase: 1044 (Д)
-----------
character: д (1076, #o2064, #x434)
preferred charset: japanese-jisx0208
(JISX0208.1983/1990 Japanese Kanji: ISO-IR-87)
code point: 0x2755
syntax: w which means: word
category:
.:Base, Y:2-byte Cyrillic, c:Chinese, h:Korean, j:Japanese, y:Cyrillic
buffer code: #xD0 #xB4
file code: ESC #x24 #x42 #x27 #x55
(encoded by coding system iso-2022-7bit)
display: by this font (glyph code)
x:-misc-fixed-medium-r-normal--14-130-75-75-c-70-iso8859-5 (#xD4)
Character code properties: customize what to show
name: CYRILLIC SMALL LETTER DE
general-category: Ll (Letter, Lowercase)
canonical-combining-class: 0 (Spacing, split, enclosing, reordrant, and Tibetan subjoined)
bidi-class: L (Left-to-Right)
mirrored: N
uppercase: 1044 (Д)
titlecase: 1044 (Д)
-----------
(it seems that the characters in this mail were unified into
iso-2022-jp by the mailer... I picked up the first one from HELLO
file.)
The following settings supercede each other and don't work well.
(set-fontset-font "fontset-startup"
'japanese-jisx0208
'("misc-fixed" . "jisx0208.1983"))
(set-fontset-font "fontset-startup"
'cyrillic-iso8859-5
'("misc-fixed" . "iso8859-5"))
Regards,
--
Yoshiaki Kasahara
Research Institute for Information Technology, Kyushu University
kasahara@nc.kyushu-u.ac.jp
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: set-fontset-font and preferred charset?
2009-07-03 5:15 set-fontset-font and preferred charset? Yoshiaki Kasahara
@ 2009-07-03 5:53 ` Kenichi Handa
2009-07-03 6:24 ` Werner LEMBERG
0 siblings, 1 reply; 23+ messages in thread
From: Kenichi Handa @ 2009-07-03 5:53 UTC (permalink / raw)
To: Yoshiaki Kasahara; +Cc: emacs-devel
In article <20090703.141522.801668491022750733.kasahara@nc.kyushu-u.ac.jp>, Yoshiaki Kasahara <kasahara@nc.kyushu-u.ac.jp> writes:
> Is there any way to specify different fonts for the same character
> with different preferred charsets?
> For example, I want to display cyrillic/greek characters using
> jisx0208.1983 fonts (wide characters) in Japanese charset texts, and
> iso8859-* fonts (narrow characters) in other context (such as email
> from other countries).
Please try this:
(set-fontset-font "fontset-default"
'cyrillic '(nil . "iso8859-5"))
(set-fontset-font "fontset-default"
'cyrillic '(nil . "jisx0208.1983-0") 'append)
(set-fontset-font "fontset-default"
'greek '(nil . "iso8859-7"))
(set-fontset-font "fontset-default"
'greek '(nil . "jisx0208.1983-0") 'append)
(set-charset-priority 'iso-8859-5 'iso-8859-7)
When you read a Japanese file encoded in iso-2022-jp,
euc-jp, or sjis, or receive an email of those encodings,
cyrillic/greek characters get `charset' text-property as
japanese-jisx0208, thus "jisx0208.1983-0" font is used.
Otherwize, cyrillic/greek characters don't have such
property, thus "iso8859-*" font is used according to the
default charset priority.
---
Kenichi Handa
handa@m17n.org
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: set-fontset-font and preferred charset?
2009-07-03 5:53 ` Kenichi Handa
@ 2009-07-03 6:24 ` Werner LEMBERG
2009-07-03 7:21 ` Kenichi Handa
0 siblings, 1 reply; 23+ messages in thread
From: Werner LEMBERG @ 2009-07-03 6:24 UTC (permalink / raw)
To: handa; +Cc: kasahara, emacs-devel
> Please try this:
>
> (set-fontset-font "fontset-default"
> 'cyrillic '(nil . "iso8859-5"))
> (set-fontset-font "fontset-default"
> 'cyrillic '(nil . "jisx0208.1983-0") 'append)
> (set-fontset-font "fontset-default"
> 'greek '(nil . "iso8859-7"))
> (set-fontset-font "fontset-default"
> 'greek '(nil . "jisx0208.1983-0") 'append)
>
> (set-charset-priority 'iso-8859-5 'iso-8859-7)
There are typos; this should rather be
---
(set-fontset-font "fontset-default"
'cyrillic '(nil . "iso8859-5"))
(set-fontset-font "fontset-default"
'cyrillic '(nil . "jisx0208.1983-0") nil 'append)
(set-fontset-font "fontset-default"
'greek '(nil . "iso8859-7"))
(set-fontset-font "fontset-default"
'greek '(nil . "jisx0208.1983-0") nil 'append)
(set-charset-priority 'iso-8859-5 'iso-8859-7)
---
IMHO, this kind of setup should be the default -- I'm quite sure that
even Japanese or Chinese prefer half-width characters for Greek and
Cyrillic. Any reason against this?
Werner
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: set-fontset-font and preferred charset?
2009-07-03 6:24 ` Werner LEMBERG
@ 2009-07-03 7:21 ` Kenichi Handa
2009-07-03 8:09 ` YAMAMOTO Mitsuharu
2009-07-03 9:05 ` Yoshiaki Kasahara
0 siblings, 2 replies; 23+ messages in thread
From: Kenichi Handa @ 2009-07-03 7:21 UTC (permalink / raw)
To: Werner LEMBERG; +Cc: kasahara, emacs-devel
In article <20090703.082403.252821682.wl@gnu.org>, Werner LEMBERG <wl@gnu.org> writes:
[...]
> > (set-fontset-font "fontset-default"
> > 'cyrillic '(nil . "jisx0208.1983-0") 'append)
[...]
> There are typos; this should rather be
Oops, right. We need nil before 'append.
> IMHO, this kind of setup should be the default -- I'm quite sure that
> even Japanese or Chinese prefer half-width characters for Greek and
> Cyrillic. Any reason against this?
Actually, 23.1 doesn't contain "jisx0208.1983-0" for
cyrillic and greek. So, they are always displayed as
half-width.
Recently, for 23.2, I added this code to make them displayed
as doble-width when charset property is some of CJK charset.
+ ;; Append CJK fonts for characters other than han, kana, cjk-misc.
+ ;; CHARSET-REGISTRY CHARSET FROM-CODE TO-CODE
+ (let ((list '(("JISX0208.1983-0" japanese-jisx0208 #x2121 #x287E)
+ ("GB2312.1980-0" chinese-gb2312 #x2121 #x297E)
+ ("BIG5-0" big5 #xA140 #xA3FE)
+ ("CNS11643.1992-1" chinese-cns11643-1 #x2121 #x427E)
+ ("KSC5601.1987-0" korean-ksc5601 #x2121 #x2C7E))))
+ (dolist (elt list)
+ (map-charset-chars
+ #'(lambda (range arg)
+ (set-fontset-font "fontset-default" range
+ (cons nil (car elt)) nil 'append))
+ (nth 1 elt) nil (nth 2 elt) (nth 3 elt))))
So, if he uses 23.2 trunk code, there's no need of extra
setting.
Perhaps, I should add that code for 23.1 too because it can
be considered as a bug that Emacs 23.1 dislays several
characters as half width by M-x list-charset-chars RET
japanese-jisx0208 RET.
---
Kenichi Handa
handa@m17n.org
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: set-fontset-font and preferred charset?
2009-07-03 7:21 ` Kenichi Handa
@ 2009-07-03 8:09 ` YAMAMOTO Mitsuharu
2009-07-06 12:17 ` Kenichi Handa
2009-07-03 9:05 ` Yoshiaki Kasahara
1 sibling, 1 reply; 23+ messages in thread
From: YAMAMOTO Mitsuharu @ 2009-07-03 8:09 UTC (permalink / raw)
To: Kenichi Handa; +Cc: kasahara, emacs-devel
>>>>> On Fri, 03 Jul 2009 16:21:40 +0900, Kenichi Handa <handa@m17n.org> said:
> So, if he uses 23.2 trunk code, there's no need of extra setting.
> Perhaps, I should add that code for 23.1 too because it can be
> considered as a bug that Emacs 23.1 dislays several characters as
> half width by M-x list-charset-chars RET japanese-jisx0208 RET.
I'm not sure if it is an intended behavior or a bug, but even with the
trunk code, M-x list-charset-chars RET japanese-jisx0208 RET shows
latin-1 characters such as PLUS-MINUS SIGN and MULTIPLICATION SIGN in
half width.
YAMAMOTO Mitsuharu
mituharu@math.s.chiba-u.ac.jp
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: set-fontset-font and preferred charset?
2009-07-03 8:09 ` YAMAMOTO Mitsuharu
@ 2009-07-06 12:17 ` Kenichi Handa
0 siblings, 0 replies; 23+ messages in thread
From: Kenichi Handa @ 2009-07-06 12:17 UTC (permalink / raw)
To: YAMAMOTO Mitsuharu; +Cc: kasahara, emacs-devel
In article <wlzlbmw5ko.wl%mituharu@math.s.chiba-u.ac.jp>, YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> writes:
>>>>>> On Fri, 03 Jul 2009 16:21:40 +0900, Kenichi Handa <handa@m17n.org> said:
> > So, if he uses 23.2 trunk code, there's no need of extra setting.
> > Perhaps, I should add that code for 23.1 too because it can be
> > considered as a bug that Emacs 23.1 dislays several characters as
> > half width by M-x list-charset-chars RET japanese-jisx0208 RET.
> I'm not sure if it is an intended behavior or a bug, but even with the
> trunk code, M-x list-charset-chars RET japanese-jisx0208 RET shows
> latin-1 characters such as PLUS-MINUS SIGN and MULTIPLICATION SIGN in
> half width.
Oops, I've overlooked that problem. Emacs searches for a
font for C in this order:
(1) search a font-group for C in the current fontset.
(2) search a font-group for C in the default fontset.
(3) search a fallback font-group of the current fontset.
(4) search a fallback font-group of the default fontset.
When a user specify a font (not fontset) as the default
font, Emacs creates an fontset based on that font, and if
the font is iso8859-1, the created fontset uses that font
for iso-8859-1 characters. So, at the step (1) above, the
default font is found for all iso-8859-1 characters although
the preferable font should be found at the step (2).
But, I'm now improving the font-searching routine for 23.2.
One of the change I have in my mind is to merge the steps
(1) and (2) (and (3) and (4)) while removing the duplicated
font specifications. Once that is done, the above problem
will be solved eventually.
---
Kenichi Handa
handa@m17n.org
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: set-fontset-font and preferred charset?
2009-07-03 7:21 ` Kenichi Handa
2009-07-03 8:09 ` YAMAMOTO Mitsuharu
@ 2009-07-03 9:05 ` Yoshiaki Kasahara
2009-07-08 7:44 ` Kenichi Handa
1 sibling, 1 reply; 23+ messages in thread
From: Yoshiaki Kasahara @ 2009-07-03 9:05 UTC (permalink / raw)
To: emacs-devel
[-- Attachment #1: Type: Text/Plain, Size: 2690 bytes --]
Thank you very much for your quick answers.
On Fri, 03 Jul 2009 16:21:40 +0900,
Kenichi Handa <handa@m17n.org> said:
> So, if he uses 23.2 trunk code, there's no need of extra
> setting.
I had just updated my binary to 23.1.50 before sending the original
message. I understand I should remove extra settings....
Still I have a couple of problems, though. Maybe my configuration is
a bit strange because I prefer X to Xft, and also I want to use
14dot fonts (I'm a k14 lover).
So my .Xdefaults contains:
Emacs.Font: -*-fixed-medium-r-normal-*-14-130-*-*-*-*-iso8859-1
Emacs.FontBackend: x, xft
1. As Mr. Yamamoto pointed out, still some characters are shown as
half width in japanese-jisx02*. Also almost all the characters
around 292x-2b7x in japanese-jisx0213* are half width (alphabets
with various accents).
2. In "HELLO" file, Cyrillic is half width, but Greek is still double
width.
3. When I open "HELLO" file, some (not all) Japanese characters in
other buffers start to be rendered using xft backend. When I open
another X frame, the font suddenly change to X font (both old and
new frames).
See attached image for 2. and 3. (I used emacs -q). It is quite
strange to me.
------------------
character: 候 (20505, #o50031, #x5019)
preferred charset: japanese-jisx0208
(JISX0208.1983/1990 Japanese Kanji: ISO-IR-87)
code point: 0x3875
syntax: w which means: word
category:
.:Base, C:2-byte han, c:Chinese, h:Korean, j:Japanese, |:line breakable
buffer code: #xE5 #x80 #x99
file code: #xB8 #xF5 (encoded by coding system japanese-iso-8bit-unix)
display: by this font (glyph code)
xft:-Misc-Fixed-normal-normal-normal-ja-18-*-*-*-c-180-iso10646-1 (#x8B9)
Character code properties: customize what to show
name: CJK IDEOGRAPH-5019
general-category: Lo (Letter, Other)
------------------
character: 候 (20505, #o50031, #x5019)
preferred charset: japanese-jisx0208
(JISX0208.1983/1990 Japanese Kanji: ISO-IR-87)
code point: 0x3875
syntax: w which means: word
category:
.:Base, C:2-byte han, c:Chinese, h:Korean, j:Japanese, |:line breakable
buffer code: #xE5 #x80 #x99
file code: #xB8 #xF5 (encoded by coding system japanese-iso-8bit-unix)
display: by this font (glyph code)
x:-misc-fixed-medium-r-normal--14-130-75-75-c-140-jisx0208.1983-0 (#x3875)
Character code properties: customize what to show
name: CJK IDEOGRAPH-5019
general-category: Lo (Letter, Other)
--
Yoshiaki Kasahara
Research Institute for Information Technology, Kyushu University
kasahara@nc.kyushu-u.ac.jp
[-- Attachment #2: emacs.png --]
[-- Type: Image/Png, Size: 8692 bytes --]
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: set-fontset-font and preferred charset?
2009-07-03 9:05 ` Yoshiaki Kasahara
@ 2009-07-08 7:44 ` Kenichi Handa
2009-07-08 8:09 ` YAMAMOTO Mitsuharu
2009-07-08 8:13 ` Yoshiaki Kasahara
0 siblings, 2 replies; 23+ messages in thread
From: Kenichi Handa @ 2009-07-08 7:44 UTC (permalink / raw)
To: Yoshiaki Kasahara; +Cc: emacs-devel
Sorry for the late response on this matter.
In article <20090703.180535.61736917731643487.kasahara@nc.kyushu-u.ac.jp>, Yoshiaki Kasahara <kasahara@nc.kyushu-u.ac.jp> writes:
> I had just updated my binary to 23.1.50 before sending the original
> message. I understand I should remove extra settings....
> Still I have a couple of problems, though. Maybe my configuration is
> a bit strange because I prefer X to Xft, and also I want to use
> 14dot fonts (I'm a k14 lover).
> So my .Xdefaults contains:
> Emacs.Font: -*-fixed-medium-r-normal-*-14-130-*-*-*-*-iso8859-1
> Emacs.FontBackend: x, xft
> 1. As Mr. Yamamoto pointed out, still some characters are shown as
> half width in japanese-jisx02*. Also almost all the characters
> around 292x-2b7x in japanese-jisx0213* are half width (alphabets
> with various accents).
This is because of the problem I wrote in the previous mail.
> 2. In "HELLO" file, Cyrillic is half width, but Greek is still double
> width.
There was a bug in setting a font for Greek in the default
fontset. I've just fixed it both for EMACS_23_1_RC and the
trunk.
> 3. When I open "HELLO" file, some (not all) Japanese characters in
> other buffers start to be rendered using xft backend. When I open
> another X frame, the font suddenly change to X font (both old and
> new frames).
There was a silly bug in handling a preferred charset in
fontset_find_font. I've installed a fix for the trunk. For
EMACS_23_1_RC branch, I'm now trying to find a smaller
change.
Anyway, could you please check the problems 2 and 3 with the
CVS trunk code?
---
Kenichi Handa
handa@m17n.org
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: set-fontset-font and preferred charset?
2009-07-08 7:44 ` Kenichi Handa
@ 2009-07-08 8:09 ` YAMAMOTO Mitsuharu
2009-07-08 8:48 ` YAMAMOTO Mitsuharu
2009-07-08 8:13 ` Yoshiaki Kasahara
1 sibling, 1 reply; 23+ messages in thread
From: YAMAMOTO Mitsuharu @ 2009-07-08 8:09 UTC (permalink / raw)
To: Kenichi Handa; +Cc: Yoshiaki Kasahara, emacs-devel
>>>>> On Wed, 08 Jul 2009 16:44:50 +0900, Kenichi Handa <handa@m17n.org> said:
>> 3. When I open "HELLO" file, some (not all) Japanese characters in
>> other buffers start to be rendered using xft backend. When I open
>> another X frame, the font suddenly change to X font (both old and
>> new frames).
> There was a silly bug in handling a preferred charset in
> fontset_find_font. I've installed a fix for the trunk.
Could you try compiling it with -DENABLE_CHECKING? I got
.../src/fontset.c:618: Emacs fatal error: assertion failed: VECTORLIKEP((rfont_def))
with the current trunk code when I tried C-h h. It doesn't happen
with the EMACS_23_1_RC branch.
YAMAMOTO Mitsuharu
mituharu@math.s.chiba-u.ac.jp
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: set-fontset-font and preferred charset?
2009-07-08 8:09 ` YAMAMOTO Mitsuharu
@ 2009-07-08 8:48 ` YAMAMOTO Mitsuharu
2009-07-08 11:29 ` Kenichi Handa
0 siblings, 1 reply; 23+ messages in thread
From: YAMAMOTO Mitsuharu @ 2009-07-08 8:48 UTC (permalink / raw)
To: Kenichi Handa; +Cc: Yoshiaki Kasahara, emacs-devel
>>>>> On Wed, 08 Jul 2009 17:09:35 +0900, YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> said:
>>>>> On Wed, 08 Jul 2009 16:44:50 +0900, Kenichi Handa <handa@m17n.org> said:
>>> 3. When I open "HELLO" file, some (not all) Japanese characters in
>>> other buffers start to be rendered using xft backend. When I open
>>> another X frame, the font suddenly change to X font (both old and
>>> new frames).
>> There was a silly bug in handling a preferred charset in
>> fontset_find_font. I've installed a fix for the trunk.
> Could you try compiling it with -DENABLE_CHECKING? I got
> .../src/fontset.c:618: Emacs fatal error: assertion failed:
> VECTORLIKEP((rfont_def))
> with the current trunk code when I tried C-h h. It doesn't happen
> with the EMACS_23_1_RC branch.
When the assertion failure happened, found_index == -1,
charset_matched == -1, and i == 0. The negative found_index is
problematic because it is used as an index for AREF.
Perhaps the following condition was missing?
Index: src/fontset.c
===================================================================
RCS file: /sources/emacs/emacs/src/fontset.c,v
retrieving revision 1.177
diff -c -p -r1.177 fontset.c
*** src/fontset.c 8 Jul 2009 03:49:12 -0000 1.177
--- src/fontset.c 8 Jul 2009 08:41:15 -0000
*************** fontset_find_font (fontset, c, face, id,
*** 575,581 ****
Lisp_Object font_def;
Lisp_Object font_entity, font_object;
! if (i == 0)
{
/* Try the element matching with the charset ID at first. */
found_index = charset_matched;
--- 575,581 ----
Lisp_Object font_def;
Lisp_Object font_entity, font_object;
! if (i == 0 && charset_matched >= 0)
{
/* Try the element matching with the charset ID at first. */
found_index = charset_matched;
YAMAMOTO Mitsuharu
mituharu@math.s.chiba-u.ac.jp
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: set-fontset-font and preferred charset?
2009-07-08 8:48 ` YAMAMOTO Mitsuharu
@ 2009-07-08 11:29 ` Kenichi Handa
2009-07-09 0:00 ` YAMAMOTO Mitsuharu
0 siblings, 1 reply; 23+ messages in thread
From: Kenichi Handa @ 2009-07-08 11:29 UTC (permalink / raw)
To: YAMAMOTO Mitsuharu; +Cc: kasahara, emacs-devel
In article <wlocrvtva5.wl%mituharu@math.s.chiba-u.ac.jp>, YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> writes:
>>>>>> On Wed, 08 Jul 2009 17:09:35 +0900, YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> said:
>>>>>> On Wed, 08 Jul 2009 16:44:50 +0900, Kenichi Handa <handa@m17n.org> said:
>>>> 3. When I open "HELLO" file, some (not all) Japanese characters in
>>>> other buffers start to be rendered using xft backend. When I open
>>>> another X frame, the font suddenly change to X font (both old and
>>>> new frames).
>>> There was a silly bug in handling a preferred charset in
>>> fontset_find_font. I've installed a fix for the trunk.
> > Could you try compiling it with -DENABLE_CHECKING? I got
> > .../src/fontset.c:618: Emacs fatal error: assertion failed:
> > VECTORLIKEP((rfont_def))
> > with the current trunk code when I tried C-h h. It doesn't happen
> > with the EMACS_23_1_RC branch.
I can't reproduce that bug but perhaps that is because we
have different font setting.
> When the assertion failure happened, found_index == -1,
> charset_matched == -1, and i == 0. The negative found_index is
> problematic because it is used as an index for AREF.
I think I found what is wrong. Could you please try this
patch?
---
Kenichi Handa
handa@m17n.org
--- fontset.c.~1.177.~ 2009-07-07 20:27:15.000000000 +0900
+++ fontset.c 2009-07-08 20:26:45.000000000 +0900
@@ -575,25 +575,25 @@
Lisp_Object font_def;
Lisp_Object font_entity, font_object;
+ found_index = i;
if (i == 0)
{
- /* Try the element matching with the charset ID at first. */
- found_index = charset_matched;
if (charset_matched > 0)
{
+ /* Try the element matching with the charset ID at first. */
+ found_index = charset_matched;
+ /* Make this negative so that we don't come here in the
+ next loop. */
charset_matched = - charset_matched;
+ /* We must try the first element in the next loop. */
i--;
}
}
- else if (i != - charset_matched)
- {
- found_index = i;
- }
- else
+ else if (i == - charset_matched)
{
/* We have already tried this element and the followings
- that have the same font specifications. So, skip them
- all. */
+ that have the same font specifications in the first
+ iteration. So, skip them all. */
rfont_def = AREF (vec, i);
font_def = RFONT_DEF_FONT_DEF (rfont_def);
for (; i + 1 < ASIZE (vec); i++)
@@ -610,7 +610,7 @@
rfont_def = AREF (vec, found_index);
if (NILP (rfont_def))
{
- if (charset_matched < 0)
+ if (i < 0)
continue;
/* This is a sign of not to try the other fonts. */
return Qt;
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: set-fontset-font and preferred charset?
2009-07-08 11:29 ` Kenichi Handa
@ 2009-07-09 0:00 ` YAMAMOTO Mitsuharu
2009-07-09 1:06 ` Kenichi Handa
0 siblings, 1 reply; 23+ messages in thread
From: YAMAMOTO Mitsuharu @ 2009-07-09 0:00 UTC (permalink / raw)
To: Kenichi Handa; +Cc: kasahara, emacs-devel
>>>>> On Wed, 08 Jul 2009 20:29:38 +0900, Kenichi Handa <handa@m17n.org> said:
> I can't reproduce that bug but perhaps that is because we have
> different font setting.
>> When the assertion failure happened, found_index == -1,
>> charset_matched == -1, and i == 0. The negative found_index is
>> problematic because it is used as an index for AREF.
> I think I found what is wrong. Could you please try this patch?
With the patch, the trunk code no longer crashes. Thanks.
YAMAMOTO Mitsuharu
mituharu@math.s.chiba-u.ac.jp
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: set-fontset-font and preferred charset?
2009-07-09 0:00 ` YAMAMOTO Mitsuharu
@ 2009-07-09 1:06 ` Kenichi Handa
0 siblings, 0 replies; 23+ messages in thread
From: Kenichi Handa @ 2009-07-09 1:06 UTC (permalink / raw)
To: YAMAMOTO Mitsuharu; +Cc: kasahara, emacs-devel
In article <wlk52irah1.wl%mituharu@math.s.chiba-u.ac.jp>, YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> writes:
>>>>>> On Wed, 08 Jul 2009 20:29:38 +0900, Kenichi Handa <handa@m17n.org> said:
> > I can't reproduce that bug but perhaps that is because we have
> > different font setting.
>>> When the assertion failure happened, found_index == -1,
>>> charset_matched == -1, and i == 0. The negative found_index is
>>> problematic because it is used as an index for AREF.
> > I think I found what is wrong. Could you please try this patch?
> With the patch, the trunk code no longer crashes. Thanks.
Thank you for testing it. I've just committed it.
---
Kenichi Handa
handa@m17n.org
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: set-fontset-font and preferred charset?
2009-07-08 7:44 ` Kenichi Handa
2009-07-08 8:09 ` YAMAMOTO Mitsuharu
@ 2009-07-08 8:13 ` Yoshiaki Kasahara
2009-07-09 1:21 ` Kenichi Handa
1 sibling, 1 reply; 23+ messages in thread
From: Yoshiaki Kasahara @ 2009-07-08 8:13 UTC (permalink / raw)
To: emacs-devel
On Wed, 08 Jul 2009 16:44:50 +0900,
Kenichi Handa <handa@m17n.org> said:
>> 1. As Mr. Yamamoto pointed out, still some characters are shown as
>> half width in japanese-jisx02*. Also almost all the characters
>> around 292x-2b7x in japanese-jisx0213* are half width (alphabets
>> with various accents).
>
> This is because of the problem I wrote in the previous mail.
Is there any workaround for the problem for now ? At least I want
MULTIPLICATION SIGN to be full width...
> Anyway, could you please check the problems 2 and 3 with the
> CVS trunk code?
I believe they are fixed because I couldn't reproduce them now. Thank
you very much!
Regards,
--
Yoshiaki Kasahara
Research Institute for Information Technology, Kyushu University
kasahara@nc.kyushu-u.ac.jp
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: set-fontset-font and preferred charset?
2009-07-08 8:13 ` Yoshiaki Kasahara
@ 2009-07-09 1:21 ` Kenichi Handa
2009-07-09 2:40 ` Yoshiaki Kasahara
0 siblings, 1 reply; 23+ messages in thread
From: Kenichi Handa @ 2009-07-09 1:21 UTC (permalink / raw)
To: Yoshiaki Kasahara; +Cc: emacs-devel
In article <20090708.171340.824917111869309420.kasahara@nc.kyushu-u.ac.jp>, Yoshiaki Kasahara <kasahara@nc.kyushu-u.ac.jp> writes:
> Is there any workaround for the problem for now ? At least I want
> MULTIPLICATION SIGN to be full width...
Please try this.
(if (display-graphic-p)
(set-fontset-font (face-attribute 'default :fontset)
'(#x80 . #xFFFF) '(nil . "jisx0208.1983-0")
nil 'append))
---
Kenichi Handa
handa@m17n.org
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: set-fontset-font and preferred charset?
2009-07-09 1:21 ` Kenichi Handa
@ 2009-07-09 2:40 ` Yoshiaki Kasahara
2009-07-09 3:55 ` Kenichi Handa
0 siblings, 1 reply; 23+ messages in thread
From: Yoshiaki Kasahara @ 2009-07-09 2:40 UTC (permalink / raw)
To: handa; +Cc: emacs-devel
On Thu, 09 Jul 2009 10:21:32 +0900,
Kenichi Handa <handa@m17n.org> said:
> In article <20090708.171340.824917111869309420.kasahara@nc.kyushu-u.ac.jp>, Yoshiaki Kasahara <kasahara@nc.kyushu-u.ac.jp> writes:
>
>> Is there any workaround for the problem for now ? At least I want
>> MULTIPLICATION SIGN to be full width...
>
> Please try this.
>
> (if (display-graphic-p)
> (set-fontset-font (face-attribute 'default :fontset)
> '(#x80 . #xFFFF) '(nil . "jisx0208.1983-0")
> nil 'append))
It fixed displaying characters with japanese-jisx0208 text-property.
Characters without such a text-property were still shown as half
width. On the other hand, greek/cyrillic characters with proper
text-property were shown as full width... Maybe I should wait until
the new font selection code is implemented.
For example, when I find a new text file and type "×", it is shown as
half width even if its file-coding-system is iso-2022-jp. After save
the file and find it again, it is shown as full width. But when I
input an additional "×" using "japanese" input method (using C-\), it
is shown as half width until I finalize the character. Also a
character inserted at the very beginning of the buffer won't receive a
japanese-jisx0208 text-property and becomes half width.
My preference is "full width as a default" even when there is no
text-property such as in *scratch* and a mini-buffer (because I'm a
Japapanese using Japanese input method). Maybe it causes some
(unicode?) text mistakenly shown as full width, but I can torelate
it...
Even when there is no text-property, C-u C-x = seems to shows correct
"preferred charset" in many cases. I'm wondering what is the meaning
and purpose of preferred charset, how it is decided, and why it is not
matched with the font registry. As discussed in another thread,
fontsets/charsets are pretty difficult to understand for me...
Regards,
--
Yoshiaki Kasahara
Research Institute for Information Technology, Kyushu University
kasahara@nc.kyushu-u.ac.jp
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: set-fontset-font and preferred charset?
2009-07-09 2:40 ` Yoshiaki Kasahara
@ 2009-07-09 3:55 ` Kenichi Handa
2009-07-09 4:32 ` Yoshiaki Kasahara
0 siblings, 1 reply; 23+ messages in thread
From: Kenichi Handa @ 2009-07-09 3:55 UTC (permalink / raw)
To: Yoshiaki Kasahara; +Cc: emacs-devel
In article <20090709.114041.738341096801775186.kasahara@nc.kyushu-u.ac.jp>, Yoshiaki Kasahara <kasahara@nc.kyushu-u.ac.jp> writes:
> > Please try this.
> >
> > (if (display-graphic-p)
> > (set-fontset-font (face-attribute 'default :fontset)
> > '(#x80 . #xFFFF) '(nil . "jisx0208.1983-0")
> > nil 'append))
> It fixed displaying characters with japanese-jisx0208 text-property.
> Characters without such a text-property were still shown as half
> width.
What is you locale? Isn't it ja_JP?
---
Kenichi Handa
handa@m17n.org
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: set-fontset-font and preferred charset?
2009-07-09 3:55 ` Kenichi Handa
@ 2009-07-09 4:32 ` Yoshiaki Kasahara
2009-07-09 4:50 ` Kenichi Handa
0 siblings, 1 reply; 23+ messages in thread
From: Yoshiaki Kasahara @ 2009-07-09 4:32 UTC (permalink / raw)
To: handa; +Cc: emacs-devel
On Thu, 09 Jul 2009 12:55:10 +0900,
Kenichi Handa <handa@m17n.org> said:
>> It fixed displaying characters with japanese-jisx0208 text-property.
>> Characters without such a text-property were still shown as half
>> width.
>
> What is you locale? Isn't it ja_JP?
I'm using "ja_JP.eucJP" as my LANG environment. Also
currrent-language-environment is "Japansese"...
--
Yoshiaki Kasahara
Research Institute for Information Technology, Kyushu University
kasahara@nc.kyushu-u.ac.jp
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: set-fontset-font and preferred charset?
2009-07-09 4:32 ` Yoshiaki Kasahara
@ 2009-07-09 4:50 ` Kenichi Handa
2009-07-09 5:06 ` Yoshiaki Kasahara
0 siblings, 1 reply; 23+ messages in thread
From: Kenichi Handa @ 2009-07-09 4:50 UTC (permalink / raw)
To: Yoshiaki Kasahara; +Cc: emacs-devel
In article <20090709.133204.586026057195367473.kasahara@nc.kyushu-u.ac.jp>, Yoshiaki Kasahara <kasahara@nc.kyushu-u.ac.jp> writes:
> On Thu, 09 Jul 2009 12:55:10 +0900,
> Kenichi Handa <handa@m17n.org> said:
>>> It fixed displaying characters with japanese-jisx0208 text-property.
>>> Characters without such a text-property were still shown
>>> as half width.
> >
> > What is you locale? Isn't it ja_JP?
> I'm using "ja_JP.eucJP" as my LANG environment. Also
> currrent-language-environment is "Japansese"...
Then, please show me the result of M-x describe-fontset RET RET.
Only the lines before "---<fallback to the default fontset>---"
are necessary.
---
Kenichi Handa
handa@m17n.org
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: set-fontset-font and preferred charset?
2009-07-09 4:50 ` Kenichi Handa
@ 2009-07-09 5:06 ` Yoshiaki Kasahara
2009-07-09 12:00 ` Kenichi Handa
0 siblings, 1 reply; 23+ messages in thread
From: Yoshiaki Kasahara @ 2009-07-09 5:06 UTC (permalink / raw)
To: handa; +Cc: emacs-devel
On Thu, 09 Jul 2009 13:50:05 +0900,
Kenichi Handa <handa@m17n.org> said:
> Then, please show me the result of M-x describe-fontset RET RET.
> Only the lines before "---<fallback to the default fontset>---"
> are necessary.
Here it is (emacs -q with the workaround code evaled):
Fontset: -misc-fixed-medium-r-normal--14-*-75-75-c-70-fontset-startup
CHAR RANGE (CODE RANGE)
FONT NAME (REQUESTED and [OPENED])
C-@ .. DEL
-*-*-*-*-*-*-*-*-*-*-*-*-iso8859-1
\200 .. (#x80 .. #xFF)
-*-*-*-*-*-*-*-*-*-*-*-*-iso8859-1
-*-*-*-*-*-*-*-*-*-*-*-*-jisx0208.1983-0
.. (#x100 .. #xFFFF)
-*-*-*-*-*-*-*-*-*-*-*-*-jisx0208.1983-0
.. (#x10000 .. #x3FFF7F)
-*-*-*-*-*-*-*-*-*-*-*-*-iso8859-1
\200 .. \377 (#x3FFF80 .. #x3FFFFF)
-*-*-*-*-*-*-*-*-*-*-*-*-iso8859-1
---<fallback to the default fontset>---
(I removed some characters because my mailer didn't allow me to send
them...)
--
Yoshiaki Kasahara
Research Institute for Information Technology, Kyushu University
kasahara@nc.kyushu-u.ac.jp
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: set-fontset-font and preferred charset?
2009-07-09 5:06 ` Yoshiaki Kasahara
@ 2009-07-09 12:00 ` Kenichi Handa
2009-07-10 2:52 ` Yoshiaki Kasahara
0 siblings, 1 reply; 23+ messages in thread
From: Kenichi Handa @ 2009-07-09 12:00 UTC (permalink / raw)
To: Yoshiaki Kasahara; +Cc: emacs-devel
In article <20090709.140615.308756192925110043.kasahara@nc.kyushu-u.ac.jp>, Yoshiaki Kasahara <kasahara@nc.kyushu-u.ac.jp> writes:
> Fontset: -misc-fixed-medium-r-normal--14-*-75-75-c-70-fontset-startup
> CHAR RANGE (CODE RANGE)
> FONT NAME (REQUESTED and [OPENED])
> C-@ .. DEL
> -*-*-*-*-*-*-*-*-*-*-*-*-iso8859-1
> \200 .. (#x80 .. #xFF)
> -*-*-*-*-*-*-*-*-*-*-*-*-iso8859-1
> -*-*-*-*-*-*-*-*-*-*-*-*-jisx0208.1983-0
> .. (#x100 .. #xFFFF)
> -*-*-*-*-*-*-*-*-*-*-*-*-jisx0208.1983-0
> .. (#x10000 .. #x3FFF7F)
> -*-*-*-*-*-*-*-*-*-*-*-*-iso8859-1
> \200 .. \377 (#x3FFF80 .. #x3FFFFF)
> -*-*-*-*-*-*-*-*-*-*-*-*-iso8859-1
> ---<fallback to the default fontset>---
This list looks good. Please try this workarond code
instead. At least, it works for me.
(if (display-graphic-p)
(let ((fontset (face-attribute 'default :fontset)))
(set-fontset-font fontset '(#x80 . #xFF)
(font-spec :registry "iso8859-1" :script 'latin))
(set-fontset-font fontset 'greek '(nil . "iso8859-7"))
(set-fontset-font fontset 'cyrillic '(nil . "iso8859-5"))
(set-fontset-font fontset '(#x80 . #xFFFF) '(nil . "jisx0208.1983-0")
nil 'append)))
---
Kenichi Handa
handa@m17n.org
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: set-fontset-font and preferred charset?
2009-07-09 12:00 ` Kenichi Handa
@ 2009-07-10 2:52 ` Yoshiaki Kasahara
2009-07-10 4:05 ` Kenichi Handa
0 siblings, 1 reply; 23+ messages in thread
From: Yoshiaki Kasahara @ 2009-07-10 2:52 UTC (permalink / raw)
To: handa; +Cc: emacs-devel
On Thu, 09 Jul 2009 21:00:25 +0900,
Kenichi Handa <handa@m17n.org> said:
> This list looks good. Please try this workarond code
> instead. At least, it works for me.
>
> (if (display-graphic-p)
> (let ((fontset (face-attribute 'default :fontset)))
> (set-fontset-font fontset '(#x80 . #xFF)
> (font-spec :registry "iso8859-1" :script 'latin))
> (set-fontset-font fontset 'greek '(nil . "iso8859-7"))
> (set-fontset-font fontset 'cyrillic '(nil . "iso8859-5"))
> (set-fontset-font fontset '(#x80 . #xFFFF) '(nil . "jisx0208.1983-0")
> nil 'append)))
It worked for me, too. It seems quite complicated, but I'll try to
understand them and add other charsets if I need. Thank you very
much.
--
Yoshiaki Kasahara
Research Institute for Information Technology, Kyushu University
kasahara@nc.kyushu-u.ac.jp
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: set-fontset-font and preferred charset?
2009-07-10 2:52 ` Yoshiaki Kasahara
@ 2009-07-10 4:05 ` Kenichi Handa
0 siblings, 0 replies; 23+ messages in thread
From: Kenichi Handa @ 2009-07-10 4:05 UTC (permalink / raw)
To: Yoshiaki Kasahara; +Cc: emacs-devel
In article <20090710.115245.579061707355054240.kasahara@nc.kyushu-u.ac.jp>, Yoshiaki Kasahara <kasahara@nc.kyushu-u.ac.jp> writes:
> > (if (display-graphic-p)
> > (let ((fontset (face-attribute 'default :fontset)))
> > (set-fontset-font fontset '(#x80 . #xFF)
> > (font-spec :registry "iso8859-1" :script 'latin))
> > (set-fontset-font fontset 'greek '(nil . "iso8859-7"))
> > (set-fontset-font fontset 'cyrillic '(nil . "iso8859-5"))
> > (set-fontset-font fontset '(#x80 . #xFFFF) '(nil . "jisx0208.1983-0")
> > nil 'append)))
> It worked for me, too.
That's good. I'll add this workaround in etc/PROBLEMS.
---
Kenichi Handa
handa@m17n.org
^ permalink raw reply [flat|nested] 23+ messages in thread
end of thread, other threads:[~2009-07-10 4:05 UTC | newest]
Thread overview: 23+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-03 5:15 set-fontset-font and preferred charset? Yoshiaki Kasahara
2009-07-03 5:53 ` Kenichi Handa
2009-07-03 6:24 ` Werner LEMBERG
2009-07-03 7:21 ` Kenichi Handa
2009-07-03 8:09 ` YAMAMOTO Mitsuharu
2009-07-06 12:17 ` Kenichi Handa
2009-07-03 9:05 ` Yoshiaki Kasahara
2009-07-08 7:44 ` Kenichi Handa
2009-07-08 8:09 ` YAMAMOTO Mitsuharu
2009-07-08 8:48 ` YAMAMOTO Mitsuharu
2009-07-08 11:29 ` Kenichi Handa
2009-07-09 0:00 ` YAMAMOTO Mitsuharu
2009-07-09 1:06 ` Kenichi Handa
2009-07-08 8:13 ` Yoshiaki Kasahara
2009-07-09 1:21 ` Kenichi Handa
2009-07-09 2:40 ` Yoshiaki Kasahara
2009-07-09 3:55 ` Kenichi Handa
2009-07-09 4:32 ` Yoshiaki Kasahara
2009-07-09 4:50 ` Kenichi Handa
2009-07-09 5:06 ` Yoshiaki Kasahara
2009-07-09 12:00 ` Kenichi Handa
2009-07-10 2:52 ` Yoshiaki Kasahara
2009-07-10 4:05 ` Kenichi Handa
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.