diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/font.c | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/src/font.c b/src/font.c index 0c9a625e770..0948d5047f7 100644 --- a/src/font.c +++ b/src/font.c | |||
| @@ -3811,6 +3811,7 @@ font_range (pos, limit, w, face, string) | |||
| 3811 | 3811 | ||
| 3812 | category = CHAR_TABLE_REF (Vunicode_category_table, c); | 3812 | category = CHAR_TABLE_REF (Vunicode_category_table, c); |
| 3813 | if (! EQ (category, QCf) | 3813 | if (! EQ (category, QCf) |
| 3814 | && ! CHAR_VARIATION_SELECTOR_P (c) | ||
| 3814 | && font_encode_char (font_object, c) == FONT_INVALID_CODE) | 3815 | && font_encode_char (font_object, c) == FONT_INVALID_CODE) |
| 3815 | { | 3816 | { |
| 3816 | Lisp_Object f = font_for_char (face, c, pos - 1, string); | 3817 | Lisp_Object f = font_for_char (face, c, pos - 1, string); |
| @@ -3832,6 +3833,7 @@ font_range (pos, limit, w, face, string) | |||
| 3832 | FETCH_STRING_CHAR_ADVANCE_NO_CHECK (c, string, i, i_byte); | 3833 | FETCH_STRING_CHAR_ADVANCE_NO_CHECK (c, string, i, i_byte); |
| 3833 | category = CHAR_TABLE_REF (Vunicode_category_table, c); | 3834 | category = CHAR_TABLE_REF (Vunicode_category_table, c); |
| 3834 | if (! EQ (category, QCf) | 3835 | if (! EQ (category, QCf) |
| 3836 | && ! CHAR_VARIATION_SELECTOR_P (c) | ||
| 3835 | && font_encode_char (f, c) == FONT_INVALID_CODE) | 3837 | && font_encode_char (f, c) == FONT_INVALID_CODE) |
| 3836 | { | 3838 | { |
| 3837 | *limit = pos - 1; | 3839 | *limit = pos - 1; |
| @@ -4407,6 +4409,47 @@ created glyph-string. Otherwise, the value is nil. */) | |||
| 4407 | return composition_gstring_put_cache (gstring, XINT (n)); | 4409 | return composition_gstring_put_cache (gstring, XINT (n)); |
| 4408 | } | 4410 | } |
| 4409 | 4411 | ||
| 4412 | DEFUN ("font-variation-glyphs", Ffont_variation_glyphs, Sfont_variation_glyphs, | ||
| 4413 | 2, 2, 0, | ||
| 4414 | doc: /* Return a list of variation glyphs for CHAR in FONT-OBJECT. | ||
| 4415 | Each element of the value is a cons (VARIATION-SELECTOR . GLYPH-ID), | ||
| 4416 | where | ||
| 4417 | VARIATION-SELECTOR is a chracter code of variation selection | ||
| 4418 | (#xFE00..#xFE0F or #xE0100..#xE01EF) | ||
| 4419 | GLYPH-ID is a glyph code of the corresponding variation glyph. */) | ||
| 4420 | (font_object, character) | ||
| 4421 | Lisp_Object font_object, character; | ||
| 4422 | { | ||
| 4423 | unsigned variations[256]; | ||
| 4424 | struct font *font; | ||
| 4425 | int i, n; | ||
| 4426 | Lisp_Object val; | ||
| 4427 | |||
| 4428 | CHECK_FONT_OBJECT (font_object); | ||
| 4429 | CHECK_CHARACTER (character); | ||
| 4430 | font = XFONT_OBJECT (font_object); | ||
| 4431 | if (! font->driver->get_variation_glyphs) | ||
| 4432 | return Qnil; | ||
| 4433 | n = font->driver->get_variation_glyphs (font, XINT (character), variations); | ||
| 4434 | if (! n) | ||
| 4435 | return Qnil; | ||
| 4436 | val = Qnil; | ||
| 4437 | for (i = 0; i < 255; i++) | ||
| 4438 | if (variations[i]) | ||
| 4439 | { | ||
| 4440 | Lisp_Object code; | ||
| 4441 | int vs = (i < 16 ? 0xFE00 + i : 0xE0100 + (i - 16)); | ||
| 4442 | |||
| 4443 | if (variations[i] > MOST_POSITIVE_FIXNUM) | ||
| 4444 | code = Fcons (make_number ((variations[i]) >> 16), | ||
| 4445 | make_number ((variations[i]) & 0xFFFF)); | ||
| 4446 | else | ||
| 4447 | code = make_number (variations[i]); | ||
| 4448 | val = Fcons (Fcons (make_number (vs), code), val); | ||
| 4449 | } | ||
| 4450 | return val; | ||
| 4451 | } | ||
| 4452 | |||
| 4410 | #if 0 | 4453 | #if 0 |
| 4411 | 4454 | ||
| 4412 | DEFUN ("font-drive-otf", Ffont_drive_otf, Sfont_drive_otf, 6, 6, 0, | 4455 | DEFUN ("font-drive-otf", Ffont_drive_otf, Sfont_drive_otf, 6, 6, 0, |
| @@ -5065,6 +5108,7 @@ syms_of_font () | |||
| 5065 | defsubr (&Sfont_xlfd_name); | 5108 | defsubr (&Sfont_xlfd_name); |
| 5066 | defsubr (&Sclear_font_cache); | 5109 | defsubr (&Sclear_font_cache); |
| 5067 | defsubr (&Sfont_shape_gstring); | 5110 | defsubr (&Sfont_shape_gstring); |
| 5111 | defsubr (&Sfont_variation_glyphs); | ||
| 5068 | #if 0 | 5112 | #if 0 |
| 5069 | defsubr (&Sfont_drive_otf); | 5113 | defsubr (&Sfont_drive_otf); |
| 5070 | defsubr (&Sfont_otf_alternates); | 5114 | defsubr (&Sfont_otf_alternates); |