changeset 102993:2e2d289b5f6a

(xfont_has_char): Special handling of `ja' and `ko' adstyle.
author Kenichi Handa <handa@m17n.org>
date Thu, 16 Apr 2009 01:39:08 +0000
parents 64cdf8a83bdd
children 5e8fdc259e28
files src/xfont.c
diffstat 1 files changed, 22 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/xfont.c	Thu Apr 16 01:38:35 2009 +0000
+++ b/src/xfont.c	Thu Apr 16 01:39:08 2009 +0000
@@ -792,17 +792,33 @@
   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;
+  struct charset *repertory = NULL;
 
-  if (font_registry_charsets (registry, &encoding, &repertory) < 0)
-    return -1;
+  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)