(CHAR_VARIATION_SELECTOR_P): New macro.
authorKenichi Handa <handa@m17n.org>
Tue, 30 Dec 2008 23:42:40 +0000 (23:42 +0000)
committerKenichi Handa <handa@m17n.org>
Tue, 30 Dec 2008 23:42:40 +0000 (23:42 +0000)
(CHAR_SURROGATE_PAIR_P): New macro.

src/ChangeLog
src/character.h

index cba115c..c06f20d 100644 (file)
@@ -1,3 +1,22 @@
+2008-12-30  Kenichi Handa  <handa@m17n.org>
+
+       * character.h (CHAR_VARIATION_SELECTOR_P): New macro.
+       (CHAR_SURROGATE_PAIR_P): New macro.
+
+       * font.h (struct font_driver): New member get_variation_glyphs.
+
+       * font.c (font_range): Don't require a font for a variation
+       selector.
+       (Ffont_variation_glyphs): New function.
+       (syms_of_font): Defsubr it.
+
+       * ftfont.c (ftfont_driver): Set the member get_variation_glyphs to
+       ftfont_variation_glyphs.
+       (setup_otf_gstring): New function.
+       (ftfont_drive_otf): Use it.
+       (ftfont_shape_by_flt): Handle variation selector.
+       (ftfont_variation_glyphs): New function.
+
 2008-12-30  Martin Rudalics  <rudalics@gmx.at>
 
        * frame.c (Vemacs_iconified): Remove.
index 34e696e..a766b76 100644 (file)
@@ -610,6 +610,26 @@ extern char unibyte_has_multibyte_table[256];
    ? ASCII_CHAR_WIDTH (c)      \
    : XINT (CHAR_TABLE_REF (Vchar_width_table, c)))
 
+/* If C is a variation selector, return the index numnber of the
+   variation selector (1..256).  Otherwise, return 0.  */
+
+#define CHAR_VARIATION_SELECTOR_P(c)           \
+  ((c) < 0xFE00 ? 0                            \
+   : (c) <= 0xFE0F ? (c) - 0xFE00 + 1          \
+   : (c) < 0xE0100 ? 0                         \
+   : (c) <= 0xE01EF ? (c) - 0xE0100 + 17       \
+   : 0)
+
+/* If C is a high surrogate, return 1.  If C is a low surrogate,
+   return 0. Otherwise, return 0.  */
+
+#define CHAR_SURROGATE_PAIR_P(c)       \
+  ((c) < 0xD800 ? 0                    \
+   : (c) <= 0xDBFF ? 1                 \
+   : (c) <= 0xDFFF ? 2                 \
+   : 0)
+
+
 extern int char_resolve_modifier_mask P_ ((int));
 extern int char_string P_ ((unsigned, unsigned char *));
 extern int string_char P_ ((const unsigned char *,