[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] emacs/src font.c
From: |
Kenichi Handa |
Subject: |
[Emacs-diffs] emacs/src font.c |
Date: |
Tue, 30 Dec 2008 23:41:25 +0000 |
CVSROOT: /cvsroot/emacs
Module name: emacs
Changes by: Kenichi Handa <handa> 08/12/30 23:41:25
Modified files:
src : font.c
Log message:
(font_range): Don't require a font for a variation
selector.
(Ffont_variation_glyphs): New function.
(syms_of_font): Defsubr it.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/emacs/src/font.c?cvsroot=emacs&r1=1.102&r2=1.103
Patches:
Index: font.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/font.c,v
retrieving revision 1.102
retrieving revision 1.103
diff -u -b -r1.102 -r1.103
--- font.c 30 Dec 2008 00:46:01 -0000 1.102
+++ font.c 30 Dec 2008 23:41:25 -0000 1.103
@@ -3811,6 +3811,7 @@
category = CHAR_TABLE_REF (Vunicode_category_table, c);
if (! EQ (category, QCf)
+ && ! CHAR_VARIATION_SELECTOR_P (c)
&& font_encode_char (font_object, c) == FONT_INVALID_CODE)
{
Lisp_Object f = font_for_char (face, c, pos - 1, string);
@@ -3832,6 +3833,7 @@
FETCH_STRING_CHAR_ADVANCE_NO_CHECK (c, string, i, i_byte);
category = CHAR_TABLE_REF (Vunicode_category_table, c);
if (! EQ (category, QCf)
+ && ! CHAR_VARIATION_SELECTOR_P (c)
&& font_encode_char (f, c) == FONT_INVALID_CODE)
{
*limit = pos - 1;
@@ -4407,6 +4409,47 @@
return composition_gstring_put_cache (gstring, XINT (n));
}
+DEFUN ("font-variation-glyphs", Ffont_variation_glyphs, Sfont_variation_glyphs,
+ 2, 2, 0,
+ doc: /* Return a list of variation glyphs for CHAR in FONT-OBJECT.
+Each element of the value is a cons (VARIATION-SELECTOR . GLYPH-ID),
+where
+ VARIATION-SELECTOR is a chracter code of variation selection
+ (#xFE00..#xFE0F or #xE0100..#xE01EF)
+ GLYPH-ID is a glyph code of the corresponding variation glyph. */)
+ (font_object, character)
+ Lisp_Object font_object, character;
+{
+ unsigned variations[256];
+ struct font *font;
+ int i, n;
+ Lisp_Object val;
+
+ CHECK_FONT_OBJECT (font_object);
+ CHECK_CHARACTER (character);
+ font = XFONT_OBJECT (font_object);
+ if (! font->driver->get_variation_glyphs)
+ return Qnil;
+ n = font->driver->get_variation_glyphs (font, XINT (character), variations);
+ if (! n)
+ return Qnil;
+ val = Qnil;
+ for (i = 0; i < 255; i++)
+ if (variations[i])
+ {
+ Lisp_Object code;
+ int vs = (i < 16 ? 0xFE00 + i : 0xE0100 + (i - 16));
+
+ if (variations[i] > MOST_POSITIVE_FIXNUM)
+ code = Fcons (make_number ((variations[i]) >> 16),
+ make_number ((variations[i]) & 0xFFFF));
+ else
+ code = make_number (variations[i]);
+ val = Fcons (Fcons (make_number (vs), code), val);
+ }
+ return val;
+}
+
#if 0
DEFUN ("font-drive-otf", Ffont_drive_otf, Sfont_drive_otf, 6, 6, 0,
@@ -5065,6 +5108,7 @@
defsubr (&Sfont_xlfd_name);
defsubr (&Sclear_font_cache);
defsubr (&Sfont_shape_gstring);
+ defsubr (&Sfont_variation_glyphs);
#if 0
defsubr (&Sfont_drive_otf);
defsubr (&Sfont_otf_alternates);
- [Emacs-diffs] emacs/src font.c, Chong Yidong, 2008/12/03
- [Emacs-diffs] emacs/src font.c, Chong Yidong, 2008/12/03
- [Emacs-diffs] emacs/src font.c, Kenichi Handa, 2008/12/03
- [Emacs-diffs] emacs/src font.c, Kenichi Handa, 2008/12/12
- [Emacs-diffs] emacs/src font.c, Chong Yidong, 2008/12/13
- [Emacs-diffs] emacs/src font.c, Chong Yidong, 2008/12/15
- [Emacs-diffs] emacs/src font.c, Kenichi Handa, 2008/12/16
- [Emacs-diffs] emacs/src font.c, Kenichi Handa, 2008/12/29
- [Emacs-diffs] emacs/src font.c,
Kenichi Handa <=