From bd0af90dca595476bf4ce1ae88939ac75bd34aca Mon Sep 17 00:00:00 2001 From: Kenichi Handa Date: Thu, 16 Apr 2009 01:39:36 +0000 Subject: [PATCH] (xfont_has_char): Special handling of `ja' and `ko' adstyle. --- src/ChangeLog | 32 ++++++++++++++++++++++++++++++++ src/xfont.c | 30 +++++++++++++++++++++++------- 2 files changed, 55 insertions(+), 7 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index dd663a488a3..8758ae7d10f 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,37 @@ 2009-04-16 Kenichi Handa + * xfont.c (xfont_has_char): Special handling of `ja' and `ko' + adstyle. + + * xftfont.c (xftfont_has_char): Special handling of `ja' and `ko' + adstyle. + + * ftfont.c (Qja, Qko): Don't make them static. + (enum ftfont_cache_for): New enum. + (fc_charset_table): Undo the previous change. + (ftfont_get_latin1_charset): Delete it. + (ftfont_pattern_entity): Check cache by ftfont_lookup_cache. Set + FONT_SIZE_INDEX of the entity to 0 for a scalable font. For a + non-scarable font, try to get AVERAGE_WIDTH. + (ftfont_lookup_cache): Argument FOR-FACE is changed to CACHE_FOR. + Change ft_face_cache from a list of a hash-table. Don't check + `ja' and `ko' adstyle here. + (ftfont_get_fc_charset): Call ftfont_lookup_cache with + FTFONT_CACHE_FOR_CHARET. + (ftfont_get_charset): Undo the previous change. + (ftfont_open): Call ftfont_lookup_cache with + FTFONT_CACHE_FOR_FACE. + (ftfont_close): Likewise. + (ftfont_has_char): Special handling of `ja' and `ko' adstyle. + + * font.c (font_sort_entites): Change the meaning of the arg + BEST-ONLY. Don't optimize for VEC of lenght 1. + (font_select_entity): Just return the value of font_sort_entites. + + * xfaces.c (merge_face_vectors): Reflect font properties in + to[LFACE_FONT_INDEX] to the other face attributes. Don't call + font_clear_prop if a face attribute doesn't change. + * charset.h (charset_ksc5601): Extern it. * charset.c (charset_ksc5601): New variable. diff --git a/src/xfont.c b/src/xfont.c index bae63ac8555..6d0e8d91127 100644 --- a/src/xfont.c +++ b/src/xfont.c @@ -792,17 +792,33 @@ xfont_prepare_face (f, face) return 0; } +extern Lisp_Object Qja, Qko; + static int -xfont_has_char (entity, c) - Lisp_Object entity; +xfont_has_char (font, c) + Lisp_Object font; int c; { - Lisp_Object registry = AREF (entity, FONT_REGISTRY_INDEX); + Lisp_Object registry = AREF (font, FONT_REGISTRY_INDEX); struct charset *encoding; - struct charset *repertory; - - if (font_registry_charsets (registry, &encoding, &repertory) < 0) - return -1; + struct charset *repertory = NULL; + + if (EQ (registry, Qiso10646_1)) + { + /* We use a font of `ja' and `ko' adstyle only for a character + in JISX0208 and KSC5601 charsets respectively. */ + if (EQ (AREF (font, FONT_ADSTYLE_INDEX), Qja) + && charset_jisx0208 >= 0) + encoding = repertory = CHARSET_FROM_ID (charset_jisx0208); + else if (EQ (AREF (font, FONT_ADSTYLE_INDEX), Qko) + && charset_ksc5601 >= 0) + encoding = repertory = CHARSET_FROM_ID (charset_ksc5601); + else + encoding = CHARSET_FROM_ID (charset_unicode); + } + else if (font_registry_charsets (registry, &encoding, &repertory) < 0) + /* Unknown REGISTRY, not usable. */ + return 0; if (ASCII_CHAR_P (c) && encoding->ascii_compatible_p) return 1; if (! repertory) -- 2.39.5