diff options
Diffstat (limited to 'src/fontset.c')
-rw-r--r-- | src/fontset.c | 132 |
1 files changed, 63 insertions, 69 deletions
diff --git a/src/fontset.c b/src/fontset.c index 8e0c5746fe7..55a3f78e865 100644 --- a/src/fontset.c +++ b/src/fontset.c @@ -266,7 +266,7 @@ set_fontset_fallback (Lisp_Object fontset, Lisp_Object fallback) #define RFONT_DEF_FACE(rfont_def) AREF (rfont_def, 0) #define RFONT_DEF_SET_FACE(rfont_def, face_id) \ - ASET ((rfont_def), 0, make_number (face_id)) + ASET ((rfont_def), 0, make_fixnum (face_id)) #define RFONT_DEF_FONT_DEF(rfont_def) AREF (rfont_def, 1) #define RFONT_DEF_SPEC(rfont_def) FONT_DEF_SPEC (AREF (rfont_def, 1)) #define RFONT_DEF_OBJECT(rfont_def) AREF (rfont_def, 2) @@ -276,15 +276,15 @@ set_fontset_fallback (Lisp_Object fontset, Lisp_Object fallback) the order of listing by font backends, the higher bits represents the order given by charset priority list. The smaller value is preferable. */ -#define RFONT_DEF_SCORE(rfont_def) XINT (AREF (rfont_def, 3)) +#define RFONT_DEF_SCORE(rfont_def) XFIXNUM (AREF (rfont_def, 3)) #define RFONT_DEF_SET_SCORE(rfont_def, score) \ - ASET ((rfont_def), 3, make_number (score)) + ASET ((rfont_def), 3, make_fixnum (score)) #define RFONT_DEF_NEW(rfont_def, font_def) \ do { \ - (rfont_def) = Fmake_vector (make_number (4), Qnil); \ - ASET ((rfont_def), 1, (font_def)); \ - RFONT_DEF_SET_SCORE ((rfont_def), 0); \ - } while (0) + (rfont_def) = make_nil_vector (4); \ + ASET (rfont_def, 1, font_def); \ + RFONT_DEF_SET_SCORE (rfont_def, 0); \ + } while (false) /* Return the element of FONTSET for the character C. If FONTSET is a @@ -327,11 +327,8 @@ fontset_ref (Lisp_Object fontset, int c) #define FONTSET_ADD(fontset, range, elt, add) \ (NILP (add) \ ? (NILP (range) \ - ? (set_fontset_fallback \ - (fontset, Fmake_vector (make_number (1), (elt)))) \ - : ((void) \ - Fset_char_table_range (fontset, range, \ - Fmake_vector (make_number (1), elt)))) \ + ? set_fontset_fallback (fontset, make_vector (1, elt)) \ + : (void) Fset_char_table_range (fontset, range, make_vector (1, elt))) \ : fontset_add ((fontset), (range), (elt), (add))) static void @@ -340,12 +337,12 @@ fontset_add (Lisp_Object fontset, Lisp_Object range, Lisp_Object elt, Lisp_Objec Lisp_Object args[2]; int idx = (EQ (add, Qappend) ? 0 : 1); - args[1 - idx] = Fmake_vector (make_number (1), elt); + args[1 - idx] = make_vector (1, elt); if (CONSP (range)) { - int from = XINT (XCAR (range)); - int to = XINT (XCDR (range)); + int from = XFIXNUM (XCAR (range)); + int to = XFIXNUM (XCDR (range)); int from1, to1; do { @@ -456,7 +453,7 @@ reorder_font_vector (Lisp_Object font_group, struct font *font) qsort (XVECTOR (vec)->contents, size, word_size, fontset_compare_rfontdef); EMACS_INT low_tick_bits = charset_ordered_list_tick & MOST_POSITIVE_FIXNUM; - XSETCAR (font_group, make_number (low_tick_bits)); + XSETCAR (font_group, make_fixnum (low_tick_bits)); } /* Return a font-group (actually a cons (CHARSET_ORDERED_LIST_TICK @@ -496,7 +493,7 @@ fontset_get_font_group (Lisp_Object fontset, int c) for C, or the fontset does not have fallback fonts. */ if (NILP (font_group)) { - font_group = make_number (0); + font_group = make_fixnum (0); if (c >= 0) /* Record that FONTSET does not specify fonts for C. As there's a possibility that a font is found in a fallback @@ -520,7 +517,7 @@ fontset_get_font_group (Lisp_Object fontset, int c) RFONT_DEF_SET_SCORE (rfont_def, i); ASET (font_group, i, rfont_def); } - font_group = Fcons (make_number (-1), font_group); + font_group = Fcons (make_fixnum (-1), font_group); if (c >= 0) char_table_set_range (fontset, from, to, font_group); else @@ -561,7 +558,7 @@ fontset_find_font (Lisp_Object fontset, int c, struct face *face, if (ASIZE (vec) > 1) { - if (XINT (XCAR (font_group)) != charset_ordered_list_tick) + if (XFIXNUM (XCAR (font_group)) != charset_ordered_list_tick) /* We have just created the font-group, or the charset priorities were changed. */ reorder_font_vector (font_group, face->ascii_face->font); @@ -577,7 +574,7 @@ fontset_find_font (Lisp_Object fontset, int c, struct face *face, break; repertory = FONT_DEF_REPERTORY (RFONT_DEF_FONT_DEF (rfont_def)); - if (XINT (repertory) == charset_id) + if (XFIXNUM (repertory) == charset_id) { charset_matched = i; break; @@ -633,8 +630,8 @@ fontset_find_font (Lisp_Object fontset, int c, struct face *face, /* This is a sign of not to try the other fonts. */ return Qt; } - if (INTEGERP (RFONT_DEF_FACE (rfont_def)) - && XINT (RFONT_DEF_FACE (rfont_def)) < 0) + if (FIXNUMP (RFONT_DEF_FACE (rfont_def)) + && XFIXNUM (RFONT_DEF_FACE (rfont_def)) < 0) /* We couldn't open this font last time. */ continue; @@ -701,7 +698,6 @@ fontset_find_font (Lisp_Object fontset, int c, struct face *face, { /* We found a font. Open it and insert a new element for that font in VEC. */ - Lisp_Object new_vec; int j; font_object = font_open_for_lface (f, font_entity, face->lface, @@ -711,7 +707,7 @@ fontset_find_font (Lisp_Object fontset, int c, struct face *face, RFONT_DEF_NEW (rfont_def, font_def); RFONT_DEF_SET_OBJECT (rfont_def, font_object); RFONT_DEF_SET_SCORE (rfont_def, RFONT_DEF_SCORE (rfont_def)); - new_vec = Fmake_vector (make_number (ASIZE (vec) + 1), Qnil); + Lisp_Object new_vec = make_nil_vector (ASIZE (vec) + 1); found_index++; for (j = 0; j < found_index; j++) ASET (new_vec, j, AREF (vec, j)); @@ -727,7 +723,7 @@ fontset_find_font (Lisp_Object fontset, int c, struct face *face, } /* Record that no font in this font group supports C. */ - FONTSET_SET (fontset, make_number (c), make_number (0)); + FONTSET_SET (fontset, make_fixnum (c), make_fixnum (0)); return Qnil; found: @@ -756,12 +752,12 @@ fontset_font (Lisp_Object fontset, int c, struct face *face, int id) Lisp_Object base_fontset; /* Try a font-group of FONTSET. */ - FONT_DEFERRED_LOG ("current fontset: font for", make_number (c), Qnil); + FONT_DEFERRED_LOG ("current fontset: font for", make_fixnum (c), Qnil); rfont_def = fontset_find_font (fontset, c, face, id, 0); if (VECTORP (rfont_def)) return rfont_def; if (NILP (rfont_def)) - FONTSET_SET (fontset, make_number (c), make_number (0)); + FONTSET_SET (fontset, make_fixnum (c), make_fixnum (0)); /* Try a font-group of the default fontset. */ base_fontset = FONTSET_BASE (fontset); @@ -771,37 +767,37 @@ fontset_font (Lisp_Object fontset, int c, struct face *face, int id) set_fontset_default (fontset, make_fontset (FONTSET_FRAME (fontset), Qnil, Vdefault_fontset)); - FONT_DEFERRED_LOG ("default fontset: font for", make_number (c), Qnil); + FONT_DEFERRED_LOG ("default fontset: font for", make_fixnum (c), Qnil); default_rfont_def = fontset_find_font (FONTSET_DEFAULT (fontset), c, face, id, 0); if (VECTORP (default_rfont_def)) return default_rfont_def; if (NILP (default_rfont_def)) - FONTSET_SET (FONTSET_DEFAULT (fontset), make_number (c), - make_number (0)); + FONTSET_SET (FONTSET_DEFAULT (fontset), make_fixnum (c), + make_fixnum (0)); } /* Try a fallback font-group of FONTSET. */ if (! EQ (rfont_def, Qt)) { - FONT_DEFERRED_LOG ("current fallback: font for", make_number (c), Qnil); + FONT_DEFERRED_LOG ("current fallback: font for", make_fixnum (c), Qnil); rfont_def = fontset_find_font (fontset, c, face, id, 1); if (VECTORP (rfont_def)) return rfont_def; /* Remember that FONTSET has no font for C. */ - FONTSET_SET (fontset, make_number (c), Qt); + FONTSET_SET (fontset, make_fixnum (c), Qt); } /* Try a fallback font-group of the default fontset. */ if (! EQ (base_fontset, Vdefault_fontset) && ! EQ (default_rfont_def, Qt)) { - FONT_DEFERRED_LOG ("default fallback: font for", make_number (c), Qnil); + FONT_DEFERRED_LOG ("default fallback: font for", make_fixnum (c), Qnil); rfont_def = fontset_find_font (FONTSET_DEFAULT (fontset), c, face, id, 1); if (VECTORP (rfont_def)) return rfont_def; /* Remember that the default fontset has no font for C. */ - FONTSET_SET (FONTSET_DEFAULT (fontset), make_number (c), Qt); + FONTSET_SET (FONTSET_DEFAULT (fontset), make_fixnum (c), Qt); } return Qnil; @@ -830,7 +826,7 @@ make_fontset (Lisp_Object frame, Lisp_Object name, Lisp_Object base) fontset = Fmake_char_table (Qfontset, Qnil); - set_fontset_id (fontset, make_number (id)); + set_fontset_id (fontset, make_fixnum (id)); if (NILP (base)) set_fontset_name (fontset, name); else @@ -892,7 +888,7 @@ free_face_fontset (struct frame *f, struct face *face) next_fontset_id = face->fontset; if (! NILP (FONTSET_DEFAULT (fontset))) { - int id = XINT (FONTSET_ID (FONTSET_DEFAULT (fontset))); + int id = XFIXNUM (FONTSET_ID (FONTSET_DEFAULT (fontset))); fontset = AREF (Vfontset_table, id); eassert (!NILP (fontset) && ! BASE_FONTSET_P (fontset)); @@ -973,7 +969,7 @@ face_for_char (struct frame *f, struct face *face, int c, } else { - charset = Fget_char_property (make_number (pos), Qcharset, object); + charset = Fget_char_property (make_fixnum (pos), Qcharset, object); if (CHARSETP (charset)) { Lisp_Object val; @@ -981,7 +977,7 @@ face_for_char (struct frame *f, struct face *face, int c, val = assq_no_quit (charset, Vfont_encoding_charset_alist); if (CONSP (val) && CHARSETP (XCDR (val))) charset = XCDR (val); - id = XINT (CHARSET_SYMBOL_ID (charset)); + id = XFIXNUM (CHARSET_SYMBOL_ID (charset)); } else id = -1; @@ -990,8 +986,8 @@ face_for_char (struct frame *f, struct face *face, int c, rfont_def = fontset_font (fontset, c, face, id); if (VECTORP (rfont_def)) { - if (INTEGERP (RFONT_DEF_FACE (rfont_def))) - face_id = XINT (RFONT_DEF_FACE (rfont_def)); + if (FIXNUMP (RFONT_DEF_FACE (rfont_def))) + face_id = XFIXNUM (RFONT_DEF_FACE (rfont_def)); else { Lisp_Object font_object; @@ -1003,12 +999,12 @@ face_for_char (struct frame *f, struct face *face, int c, } else { - if (INTEGERP (FONTSET_NOFONT_FACE (fontset))) - face_id = XINT (FONTSET_NOFONT_FACE (fontset)); + if (FIXNUMP (FONTSET_NOFONT_FACE (fontset))) + face_id = XFIXNUM (FONTSET_NOFONT_FACE (fontset)); else { face_id = face_for_font (f, Qnil, face); - set_fontset_nofont_face (fontset, make_number (face_id)); + set_fontset_nofont_face (fontset, make_fixnum (face_id)); } } eassert (face_id >= 0); @@ -1040,7 +1036,7 @@ font_for_char (struct face *face, int c, ptrdiff_t pos, Lisp_Object object) } else { - charset = Fget_char_property (make_number (pos), Qcharset, object); + charset = Fget_char_property (make_fixnum (pos), Qcharset, object); if (CHARSETP (charset)) { Lisp_Object val; @@ -1048,7 +1044,7 @@ font_for_char (struct face *face, int c, ptrdiff_t pos, Lisp_Object object) val = assq_no_quit (charset, Vfont_encoding_charset_alist); if (CONSP (val) && CHARSETP (XCDR (val))) charset = XCDR (val); - id = XINT (CHARSET_SYMBOL_ID (charset)); + id = XFIXNUM (CHARSET_SYMBOL_ID (charset)); } else id = -1; @@ -1083,7 +1079,7 @@ make_fontset_for_ascii_face (struct frame *f, int base_fontset_id, struct face * base_fontset = Vdefault_fontset; fontset = make_fontset (frame, Qnil, base_fontset); - return XINT (FONTSET_ID (fontset)); + return XFIXNUM (FONTSET_ID (fontset)); } @@ -1306,7 +1302,7 @@ free_realized_fontsets (Lisp_Object base) tail = XCDR (tail)) { struct frame *f = XFRAME (FONTSET_FRAME (this)); - int face_id = XINT (XCDR (XCAR (tail))); + int face_id = XFIXNUM (XCDR (XCAR (tail))); struct face *face = FACE_FROM_ID_OR_NULL (f, face_id); /* Face THIS itself is also freed by the following call. */ @@ -1399,7 +1395,7 @@ static void set_fontset_font (Lisp_Object arg, Lisp_Object range) { Lisp_Object fontset, font_def, add, ascii, script_range_list; - int from = XINT (XCAR (range)), to = XINT (XCDR (range)); + int from = XFIXNUM (XCAR (range)), to = XFIXNUM (XCDR (range)); fontset = AREF (arg, 0); font_def = AREF (arg, 1); @@ -1412,11 +1408,11 @@ set_fontset_font (Lisp_Object arg, Lisp_Object range) if (to < 0x80) return; from = 0x80; - range = Fcons (make_number (0x80), XCDR (range)); + range = Fcons (make_fixnum (0x80), XCDR (range)); } -#define SCRIPT_FROM XINT (XCAR (XCAR (script_range_list))) -#define SCRIPT_TO XINT (XCDR (XCAR (script_range_list))) +#define SCRIPT_FROM XFIXNUM (XCAR (XCAR (script_range_list))) +#define SCRIPT_TO XFIXNUM (XCDR (XCAR (script_range_list))) #define POP_SCRIPT_RANGE() script_range_list = XCDR (script_range_list) for (; CONSP (script_range_list) && SCRIPT_TO < from; POP_SCRIPT_RANGE ()) @@ -1424,11 +1420,11 @@ set_fontset_font (Lisp_Object arg, Lisp_Object range) if (CONSP (script_range_list)) { if (SCRIPT_FROM < from) - range = Fcons (make_number (SCRIPT_FROM), XCDR (range)); + range = Fcons (make_fixnum (SCRIPT_FROM), XCDR (range)); while (CONSP (script_range_list) && SCRIPT_TO <= to) POP_SCRIPT_RANGE (); if (CONSP (script_range_list) && SCRIPT_FROM <= to) - XSETCAR (XCAR (script_range_list), make_number (to + 1)); + XSETCAR (XCAR (script_range_list), make_fixnum (to + 1)); } FONTSET_ADD (fontset, range, font_def, add); @@ -1547,7 +1543,7 @@ appended. By default, FONT-SPEC overrides the previous settings. */) if (CHARACTERP (target)) { - if (XFASTINT (target) < 0x80) + if (XFIXNAT (target) < 0x80) error ("Can't set a font for partial ASCII range"); range_list = list1 (Fcons (target, target)); } @@ -1559,9 +1555,9 @@ appended. By default, FONT-SPEC overrides the previous settings. */) to = Fcdr (target); CHECK_CHARACTER (from); CHECK_CHARACTER (to); - if (XFASTINT (from) < 0x80) + if (XFIXNAT (from) < 0x80) { - if (XFASTINT (from) != 0 || XFASTINT (to) < 0x7F) + if (XFIXNAT (from) != 0 || XFIXNAT (to) < 0x7F) error ("Can't set a font for partial ASCII range"); ascii_changed = 1; } @@ -1632,7 +1628,7 @@ appended. By default, FONT-SPEC overrides the previous settings. */) if (ascii_changed) { Lisp_Object tail, fr; - int fontset_id = XINT (FONTSET_ID (fontset)); + int fontset_id = XFIXNUM (FONTSET_ID (fontset)); set_fontset_ascii (fontset, fontname); name = FONTSET_NAME (fontset); @@ -1765,7 +1761,7 @@ fontset_from_font (Lisp_Object font_object) val = assoc_no_quit (font_spec, auto_fontset_alist); if (CONSP (val)) - return XINT (FONTSET_ID (XCDR (val))); + return XFIXNUM (FONTSET_ID (XCDR (val))); if (num_auto_fontsets++ == 0) alias = intern ("fontset-startup"); else @@ -1800,7 +1796,7 @@ fontset_from_font (Lisp_Object font_object) set_fontset_ascii (fontset, font_name); - return XINT (FONTSET_ID (fontset)); + return XFIXNUM (FONTSET_ID (fontset)); } @@ -1988,7 +1984,7 @@ patterns. */) fontset = check_fontset_name (name, &frame); CHECK_CHARACTER (ch); - c = XINT (ch); + c = XFIXNUM (ch); list = Qnil; while (1) { @@ -2003,9 +1999,9 @@ patterns. */) if (NILP (val)) return Qnil; repertory = AREF (val, 1); - if (INTEGERP (repertory)) + if (FIXNUMP (repertory)) { - struct charset *charset = CHARSET_FROM_ID (XINT (repertory)); + struct charset *charset = CHARSET_FROM_ID (XFIXNUM (repertory)); if (! CHAR_CHARSET_P (c, charset)) continue; @@ -2062,9 +2058,7 @@ Lisp_Object dump_fontset (Lisp_Object) EXTERNALLY_VISIBLE; Lisp_Object dump_fontset (Lisp_Object fontset) { - Lisp_Object vec; - - vec = Fmake_vector (make_number (3), Qnil); + Lisp_Object vec = make_nil_vector (3); ASET (vec, 0, FONTSET_ID (fontset)); if (BASE_FONTSET_P (fontset)) @@ -2112,9 +2106,9 @@ void syms_of_fontset (void) { DEFSYM (Qfontset, "fontset"); - Fput (Qfontset, Qchar_table_extra_slots, make_number (8)); + Fput (Qfontset, Qchar_table_extra_slots, make_fixnum (8)); DEFSYM (Qfontset_info, "fontset-info"); - Fput (Qfontset_info, Qchar_table_extra_slots, make_number (1)); + Fput (Qfontset_info, Qchar_table_extra_slots, make_fixnum (1)); DEFSYM (Qappend, "append"); DEFSYM (Qlatin, "latin"); @@ -2122,12 +2116,12 @@ syms_of_fontset (void) Vcached_fontset_data = Qnil; staticpro (&Vcached_fontset_data); - Vfontset_table = Fmake_vector (make_number (32), Qnil); + Vfontset_table = make_nil_vector (32); staticpro (&Vfontset_table); Vdefault_fontset = Fmake_char_table (Qfontset, Qnil); staticpro (&Vdefault_fontset); - set_fontset_id (Vdefault_fontset, make_number (0)); + set_fontset_id (Vdefault_fontset, make_fixnum (0)); set_fontset_name (Vdefault_fontset, build_pure_c_string ("-*-*-*-*-*-*-*-*-*-*-*-*-fontset-default")); |