diff options
Diffstat (limited to 'src/fontset.c')
| -rw-r--r-- | src/fontset.c | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/src/fontset.c b/src/fontset.c index 3091f43d6e9..d06491ddf25 100644 --- a/src/fontset.c +++ b/src/fontset.c | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | /* Fontset handler. | 1 | /* Fontset handler. |
| 2 | 2 | ||
| 3 | Copyright (C) 2001-2011 Free Software Foundation, Inc. | 3 | Copyright (C) 2001-2012 Free Software Foundation, Inc. |
| 4 | Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, | 4 | Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, |
| 5 | 2005, 2006, 2007, 2008, 2009, 2010, 2011 | 5 | 2005, 2006, 2007, 2008, 2009, 2010, 2011 |
| 6 | National Institute of Advanced Industrial Science and Technology (AIST) | 6 | National Institute of Advanced Industrial Science and Technology (AIST) |
| @@ -166,7 +166,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 166 | These structures are hidden from the other codes than this file. | 166 | These structures are hidden from the other codes than this file. |
| 167 | The other codes handle fontsets only by their ID numbers. They | 167 | The other codes handle fontsets only by their ID numbers. They |
| 168 | usually use the variable name `fontset' for IDs. But, in this | 168 | usually use the variable name `fontset' for IDs. But, in this |
| 169 | file, we always use varialbe name `id' for IDs, and name `fontset' | 169 | file, we always use variable name `id' for IDs, and name `fontset' |
| 170 | for an actual fontset object, i.e., char-table. | 170 | for an actual fontset object, i.e., char-table. |
| 171 | 171 | ||
| 172 | */ | 172 | */ |
| @@ -447,7 +447,7 @@ reorder_font_vector (Lisp_Object font_group, struct font *font) | |||
| 447 | /* Return a font-group (actually a cons (-1 . FONT-GROUP-VECTOR)) for | 447 | /* Return a font-group (actually a cons (-1 . FONT-GROUP-VECTOR)) for |
| 448 | character C in FONTSET. If C is -1, return a fallback font-group. | 448 | character C in FONTSET. If C is -1, return a fallback font-group. |
| 449 | If C is not -1, the value may be Qt (FONTSET doesn't have a font | 449 | If C is not -1, the value may be Qt (FONTSET doesn't have a font |
| 450 | for C even in the fallback group, or 0 (a font for C may be found | 450 | for C even in the fallback group), or 0 (a font for C may be found |
| 451 | only in the fallback group). */ | 451 | only in the fallback group). */ |
| 452 | 452 | ||
| 453 | static Lisp_Object | 453 | static Lisp_Object |
| @@ -465,7 +465,9 @@ fontset_get_font_group (Lisp_Object fontset, int c) | |||
| 465 | if (! NILP (font_group)) | 465 | if (! NILP (font_group)) |
| 466 | return font_group; | 466 | return font_group; |
| 467 | base_fontset = FONTSET_BASE (fontset); | 467 | base_fontset = FONTSET_BASE (fontset); |
| 468 | if (c >= 0) | 468 | if (NILP (base_fontset)) |
| 469 | font_group = Qnil; | ||
| 470 | else if (c >= 0) | ||
| 469 | font_group = char_table_ref_and_range (base_fontset, c, &from, &to); | 471 | font_group = char_table_ref_and_range (base_fontset, c, &from, &to); |
| 470 | else | 472 | else |
| 471 | font_group = FONTSET_FALLBACK (base_fontset); | 473 | font_group = FONTSET_FALLBACK (base_fontset); |
| @@ -476,6 +478,8 @@ fontset_get_font_group (Lisp_Object fontset, int c) | |||
| 476 | char_table_set_range (fontset, from, to, font_group); | 478 | char_table_set_range (fontset, from, to, font_group); |
| 477 | return font_group; | 479 | return font_group; |
| 478 | } | 480 | } |
| 481 | if (!VECTORP (font_group)) | ||
| 482 | return font_group; | ||
| 479 | font_group = Fcopy_sequence (font_group); | 483 | font_group = Fcopy_sequence (font_group); |
| 480 | for (i = 0; i < ASIZE (font_group); i++) | 484 | for (i = 0; i < ASIZE (font_group); i++) |
| 481 | if (! NILP (AREF (font_group, i))) | 485 | if (! NILP (AREF (font_group, i))) |
| @@ -627,7 +631,7 @@ fontset_find_font (Lisp_Object fontset, int c, struct face *face, int id, int fa | |||
| 627 | { | 631 | { |
| 628 | /* Something strange happened, perhaps because of a | 632 | /* Something strange happened, perhaps because of a |
| 629 | Font-backend problem. Too avoid crashing, record | 633 | Font-backend problem. Too avoid crashing, record |
| 630 | that this spec is unsable. It may be better to find | 634 | that this spec is unusable. It may be better to find |
| 631 | another font of the same spec, but currently we don't | 635 | another font of the same spec, but currently we don't |
| 632 | have such an API. */ | 636 | have such an API. */ |
| 633 | RFONT_DEF_SET_FACE (rfont_def, -1); | 637 | RFONT_DEF_SET_FACE (rfont_def, -1); |
| @@ -639,7 +643,7 @@ fontset_find_font (Lisp_Object fontset, int c, struct face *face, int id, int fa | |||
| 639 | if (font_has_char (f, font_object, c)) | 643 | if (font_has_char (f, font_object, c)) |
| 640 | goto found; | 644 | goto found; |
| 641 | 645 | ||
| 642 | /* Find a font already opened, maching with the current spec, | 646 | /* Find a font already opened, matching with the current spec, |
| 643 | and supporting C. */ | 647 | and supporting C. */ |
| 644 | font_def = RFONT_DEF_FONT_DEF (rfont_def); | 648 | font_def = RFONT_DEF_FONT_DEF (rfont_def); |
| 645 | for (; found_index + 1 < ASIZE (vec); found_index++) | 649 | for (; found_index + 1 < ASIZE (vec); found_index++) |
| @@ -901,7 +905,7 @@ face_suitable_for_char_p (struct face *face, int c) | |||
| 901 | 905 | ||
| 902 | 906 | ||
| 903 | /* Return ID of face suitable for displaying character C on frame F. | 907 | /* Return ID of face suitable for displaying character C on frame F. |
| 904 | FACE must be reazlied for ASCII characters in advance. Called from | 908 | FACE must be realized for ASCII characters in advance. Called from |
| 905 | the macro FACE_FOR_CHAR. */ | 909 | the macro FACE_FOR_CHAR. */ |
| 906 | 910 | ||
| 907 | int | 911 | int |
| @@ -1084,7 +1088,7 @@ fontset_pattern_regexp (Lisp_Object pattern) | |||
| 1084 | nescs++; | 1088 | nescs++; |
| 1085 | } | 1089 | } |
| 1086 | 1090 | ||
| 1087 | /* If PATTERN is not full XLFD we conert "*" to ".*". Otherwise | 1091 | /* If PATTERN is not full XLFD we convert "*" to ".*". Otherwise |
| 1088 | we convert "*" to "[^-]*" which is much faster in regular | 1092 | we convert "*" to "[^-]*" which is much faster in regular |
| 1089 | expression matching. */ | 1093 | expression matching. */ |
| 1090 | if (ndashes < 14) | 1094 | if (ndashes < 14) |
| @@ -1342,7 +1346,7 @@ accumulate_script_ranges (Lisp_Object arg, Lisp_Object range, Lisp_Object val) | |||
| 1342 | 1346 | ||
| 1343 | In FONTSET, set FONT_DEF in a fashion specified by ADD for | 1347 | In FONTSET, set FONT_DEF in a fashion specified by ADD for |
| 1344 | characters in RANGE and ranges in SCRIPT_RANGE_LIST before RANGE. | 1348 | characters in RANGE and ranges in SCRIPT_RANGE_LIST before RANGE. |
| 1345 | The consumed ranges are poped up from SCRIPT_RANGE_LIST, and the | 1349 | The consumed ranges are popped up from SCRIPT_RANGE_LIST, and the |
| 1346 | new SCRIPT_RANGE_LIST is stored in ARG. | 1350 | new SCRIPT_RANGE_LIST is stored in ARG. |
| 1347 | 1351 | ||
| 1348 | If ASCII is nil, don't set FONT_DEF for ASCII characters. It is | 1352 | If ASCII is nil, don't set FONT_DEF for ASCII characters. It is |
| @@ -1696,9 +1700,9 @@ FONT-SPEC is a vector, a cons, or a string. See the documentation of | |||
| 1696 | static Lisp_Object auto_fontset_alist; | 1700 | static Lisp_Object auto_fontset_alist; |
| 1697 | 1701 | ||
| 1698 | /* Number of automatically created fontsets. */ | 1702 | /* Number of automatically created fontsets. */ |
| 1699 | static int num_auto_fontsets; | 1703 | static printmax_t num_auto_fontsets; |
| 1700 | 1704 | ||
| 1701 | /* Retun a fontset synthesized from FONT-OBJECT. This is called from | 1705 | /* Return a fontset synthesized from FONT-OBJECT. This is called from |
| 1702 | x_new_font when FONT-OBJECT is used for the default ASCII font of a | 1706 | x_new_font when FONT-OBJECT is used for the default ASCII font of a |
| 1703 | frame, and the returned fontset is used for the default fontset of | 1707 | frame, and the returned fontset is used for the default fontset of |
| 1704 | that frame. The fontset specifies a font of the same registry as | 1708 | that frame. The fontset specifies a font of the same registry as |
| @@ -1723,9 +1727,9 @@ fontset_from_font (Lisp_Object font_object) | |||
| 1723 | alias = intern ("fontset-startup"); | 1727 | alias = intern ("fontset-startup"); |
| 1724 | else | 1728 | else |
| 1725 | { | 1729 | { |
| 1726 | char temp[32]; | 1730 | char temp[sizeof "fontset-auto" + INT_STRLEN_BOUND (printmax_t)]; |
| 1727 | 1731 | ||
| 1728 | sprintf (temp, "fontset-auto%d", num_auto_fontsets - 1); | 1732 | sprintf (temp, "fontset-auto%"pMd, num_auto_fontsets - 1); |
| 1729 | alias = intern (temp); | 1733 | alias = intern (temp); |
| 1730 | } | 1734 | } |
| 1731 | fontset_spec = copy_font_spec (font_spec); | 1735 | fontset_spec = copy_font_spec (font_spec); |
| @@ -1784,7 +1788,7 @@ update_auto_fontset_alist (Lisp_Object font_object, Lisp_Object fontset) | |||
| 1784 | /* Return a cons (FONT-OBJECT . GLYPH-CODE). | 1788 | /* Return a cons (FONT-OBJECT . GLYPH-CODE). |
| 1785 | FONT-OBJECT is the font for the character at POSITION in the current | 1789 | FONT-OBJECT is the font for the character at POSITION in the current |
| 1786 | buffer. This is computed from all the text properties and overlays | 1790 | buffer. This is computed from all the text properties and overlays |
| 1787 | that apply to POSITION. POSTION may be nil, in which case, | 1791 | that apply to POSITION. POSITION may be nil, in which case, |
| 1788 | FONT-SPEC is the font for displaying the character CH with the | 1792 | FONT-SPEC is the font for displaying the character CH with the |
| 1789 | default face. | 1793 | default face. |
| 1790 | 1794 | ||
| @@ -2100,6 +2104,8 @@ DEFUN ("fontset-list", Ffontset_list, Sfontset_list, 0, 0, 0, | |||
| 2100 | 2104 | ||
| 2101 | #ifdef FONTSET_DEBUG | 2105 | #ifdef FONTSET_DEBUG |
| 2102 | 2106 | ||
| 2107 | Lisp_Object dump_fontset (Lisp_Object) EXTERNALLY_VISIBLE; | ||
| 2108 | |||
| 2103 | Lisp_Object | 2109 | Lisp_Object |
| 2104 | dump_fontset (Lisp_Object fontset) | 2110 | dump_fontset (Lisp_Object fontset) |
| 2105 | { | 2111 | { |