aboutsummaryrefslogtreecommitdiffstats
path: root/src/fontset.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/fontset.c')
-rw-r--r--src/fontset.c97
1 files changed, 26 insertions, 71 deletions
diff --git a/src/fontset.c b/src/fontset.c
index 84035838552..01c62000ca0 100644
--- a/src/fontset.c
+++ b/src/fontset.c
@@ -306,9 +306,7 @@ fontset_id_valid_p (id)
306 : fontset_ref ((fontset), (c))) 306 : fontset_ref ((fontset), (c)))
307 307
308static Lisp_Object 308static Lisp_Object
309fontset_ref (fontset, c) 309fontset_ref (Lisp_Object fontset, int c)
310 Lisp_Object fontset;
311 int c;
312{ 310{
313 Lisp_Object elt; 311 Lisp_Object elt;
314 312
@@ -343,8 +341,7 @@ fontset_ref (fontset, c)
343 : fontset_add ((fontset), (range), (elt), (add))) 341 : fontset_add ((fontset), (range), (elt), (add)))
344 342
345static Lisp_Object 343static Lisp_Object
346fontset_add (fontset, range, elt, add) 344fontset_add (Lisp_Object fontset, Lisp_Object range, Lisp_Object elt, Lisp_Object add)
347 Lisp_Object fontset, range, elt, add;
348{ 345{
349 Lisp_Object args[2]; 346 Lisp_Object args[2];
350 int idx = (EQ (add, Qappend) ? 0 : 1); 347 int idx = (EQ (add, Qappend) ? 0 : 1);
@@ -376,8 +373,7 @@ fontset_add (fontset, range, elt, add)
376} 373}
377 374
378static int 375static int
379fontset_compare_rfontdef (val1, val2) 376fontset_compare_rfontdef (const void *val1, const void *val2)
380 const void *val1, *val2;
381{ 377{
382 return (RFONT_DEF_SCORE (*(Lisp_Object *) val1) 378 return (RFONT_DEF_SCORE (*(Lisp_Object *) val1)
383 - RFONT_DEF_SCORE (*(Lisp_Object *) val2)); 379 - RFONT_DEF_SCORE (*(Lisp_Object *) val2));
@@ -392,12 +388,10 @@ fontset_compare_rfontdef (val1, val2)
392 If PREFERRED_FAMILY is not nil, that family has the higher priority 388 If PREFERRED_FAMILY is not nil, that family has the higher priority
393 if the encoding charsets or languages in font-specs are the same. */ 389 if the encoding charsets or languages in font-specs are the same. */
394 390
395extern Lisp_Object Fassoc_string (); 391extern Lisp_Object Fassoc_string (Lisp_Object, Lisp_Object, Lisp_Object);
396 392
397static void 393static void
398reorder_font_vector (font_group, font) 394reorder_font_vector (Lisp_Object font_group, struct font *font)
399 Lisp_Object font_group;
400 struct font *font;
401{ 395{
402 Lisp_Object vec, font_object; 396 Lisp_Object vec, font_object;
403 int size; 397 int size;
@@ -525,11 +519,7 @@ fontset_get_font_group (Lisp_Object fontset, int c)
525 If FALLBACK is nonzero, search only fallback fonts. */ 519 If FALLBACK is nonzero, search only fallback fonts. */
526 520
527static Lisp_Object 521static Lisp_Object
528fontset_find_font (fontset, c, face, id, fallback) 522fontset_find_font (Lisp_Object fontset, int c, struct face *face, int id, int fallback)
529 Lisp_Object fontset;
530 int c;
531 struct face *face;
532 int id, fallback;
533{ 523{
534 Lisp_Object vec, font_group; 524 Lisp_Object vec, font_group;
535 int i, charset_matched = 0, found_index; 525 int i, charset_matched = 0, found_index;
@@ -728,11 +718,7 @@ fontset_find_font (fontset, c, face, id, fallback)
728 718
729 719
730static Lisp_Object 720static Lisp_Object
731fontset_font (fontset, c, face, id) 721fontset_font (Lisp_Object fontset, int c, struct face *face, int id)
732 Lisp_Object fontset;
733 int c;
734 struct face *face;
735 int id;
736{ 722{
737 Lisp_Object rfont_def, default_rfont_def; 723 Lisp_Object rfont_def, default_rfont_def;
738 Lisp_Object base_fontset; 724 Lisp_Object base_fontset;
@@ -793,8 +779,7 @@ fontset_font (fontset, c, face, id)
793 BASE. */ 779 BASE. */
794 780
795static Lisp_Object 781static Lisp_Object
796make_fontset (frame, name, base) 782make_fontset (Lisp_Object frame, Lisp_Object name, Lisp_Object base)
797 Lisp_Object frame, name, base;
798{ 783{
799 Lisp_Object fontset; 784 Lisp_Object fontset;
800 int size = ASIZE (Vfontset_table); 785 int size = ASIZE (Vfontset_table);
@@ -835,8 +820,7 @@ make_fontset (frame, name, base)
835/* Return the name of the fontset who has ID. */ 820/* Return the name of the fontset who has ID. */
836 821
837Lisp_Object 822Lisp_Object
838fontset_name (id) 823fontset_name (int id)
839 int id;
840{ 824{
841 Lisp_Object fontset; 825 Lisp_Object fontset;
842 826
@@ -848,8 +832,7 @@ fontset_name (id)
848/* Return the ASCII font name of the fontset who has ID. */ 832/* Return the ASCII font name of the fontset who has ID. */
849 833
850Lisp_Object 834Lisp_Object
851fontset_ascii (id) 835fontset_ascii (int id)
852 int id;
853{ 836{
854 Lisp_Object fontset, elt; 837 Lisp_Object fontset, elt;
855 838
@@ -861,9 +844,7 @@ fontset_ascii (id)
861} 844}
862 845
863void 846void
864free_realized_fontset (f, fontset) 847free_realized_fontset (FRAME_PTR f, Lisp_Object fontset)
865 FRAME_PTR f;
866 Lisp_Object fontset;
867{ 848{
868 Lisp_Object tail; 849 Lisp_Object tail;
869 850
@@ -879,9 +860,7 @@ free_realized_fontset (f, fontset)
879 free_realized_face. */ 860 free_realized_face. */
880 861
881void 862void
882free_face_fontset (f, face) 863free_face_fontset (FRAME_PTR f, struct face *face)
883 FRAME_PTR f;
884 struct face *face;
885{ 864{
886 Lisp_Object fontset; 865 Lisp_Object fontset;
887 866
@@ -915,9 +894,7 @@ free_face_fontset (f, face)
915 when C is not an ASCII character. */ 894 when C is not an ASCII character. */
916 895
917int 896int
918face_suitable_for_char_p (face, c) 897face_suitable_for_char_p (struct face *face, int c)
919 struct face *face;
920 int c;
921{ 898{
922 Lisp_Object fontset, rfont_def; 899 Lisp_Object fontset, rfont_def;
923 900
@@ -934,11 +911,7 @@ face_suitable_for_char_p (face, c)
934 the macro FACE_FOR_CHAR. */ 911 the macro FACE_FOR_CHAR. */
935 912
936int 913int
937face_for_char (f, face, c, pos, object) 914face_for_char (FRAME_PTR f, struct face *face, int c, int pos, Lisp_Object object)
938 FRAME_PTR f;
939 struct face *face;
940 int c, pos;
941 Lisp_Object object;
942{ 915{
943 Lisp_Object fontset, rfont_def, charset; 916 Lisp_Object fontset, rfont_def, charset;
944 int face_id; 917 int face_id;
@@ -1006,10 +979,7 @@ face_for_char (f, face, c, pos, object)
1006 979
1007 980
1008Lisp_Object 981Lisp_Object
1009font_for_char (face, c, pos, object) 982font_for_char (struct face *face, int c, int pos, Lisp_Object object)
1010 struct face *face;
1011 int c, pos;
1012 Lisp_Object object;
1013{ 983{
1014 Lisp_Object fontset, rfont_def, charset; 984 Lisp_Object fontset, rfont_def, charset;
1015 int id; 985 int id;
@@ -1059,10 +1029,7 @@ font_for_char (face, c, pos, object)
1059 Called from realize_x_face. */ 1029 Called from realize_x_face. */
1060 1030
1061int 1031int
1062make_fontset_for_ascii_face (f, base_fontset_id, face) 1032make_fontset_for_ascii_face (FRAME_PTR f, int base_fontset_id, struct face *face)
1063 FRAME_PTR f;
1064 int base_fontset_id;
1065 struct face *face;
1066{ 1033{
1067 Lisp_Object base_fontset, fontset, frame; 1034 Lisp_Object base_fontset, fontset, frame;
1068 1035
@@ -1096,8 +1063,7 @@ static Lisp_Object Vcached_fontset_data;
1096 expression corresponding to PATTERN. */ 1063 expression corresponding to PATTERN. */
1097 1064
1098static Lisp_Object 1065static Lisp_Object
1099fontset_pattern_regexp (pattern) 1066fontset_pattern_regexp (Lisp_Object pattern)
1100 Lisp_Object pattern;
1101{ 1067{
1102 if (!index ((char *) SDATA (pattern), '*') 1068 if (!index ((char *) SDATA (pattern), '*')
1103 && !index ((char *) SDATA (pattern), '?')) 1069 && !index ((char *) SDATA (pattern), '?'))
@@ -1171,9 +1137,7 @@ fontset_pattern_regexp (pattern)
1171*/ 1137*/
1172 1138
1173int 1139int
1174fs_query_fontset (name, name_pattern) 1140fs_query_fontset (Lisp_Object name, int name_pattern)
1175 Lisp_Object name;
1176 int name_pattern;
1177{ 1141{
1178 Lisp_Object tem; 1142 Lisp_Object tem;
1179 int i; 1143 int i;
@@ -1246,10 +1210,7 @@ If REGEXPP is non-nil, PATTERN is a regular expression. */)
1246/* Return a list of base fontset names matching PATTERN on frame F. */ 1210/* Return a list of base fontset names matching PATTERN on frame F. */
1247 1211
1248Lisp_Object 1212Lisp_Object
1249list_fontsets (f, pattern, size) 1213list_fontsets (FRAME_PTR f, Lisp_Object pattern, int size)
1250 FRAME_PTR f;
1251 Lisp_Object pattern;
1252 int size;
1253{ 1214{
1254 Lisp_Object frame, regexp, val; 1215 Lisp_Object frame, regexp, val;
1255 int id; 1216 int id;
@@ -1285,8 +1246,7 @@ list_fontsets (f, pattern, size)
1285/* Free all realized fontsets whose base fontset is BASE. */ 1246/* Free all realized fontsets whose base fontset is BASE. */
1286 1247
1287static void 1248static void
1288free_realized_fontsets (base) 1249free_realized_fontsets (Lisp_Object base)
1289 Lisp_Object base;
1290{ 1250{
1291 int id; 1251 int id;
1292 1252
@@ -1343,8 +1303,7 @@ free_realized_fontsets (base)
1343 Set *FRAME to the actual frame. */ 1303 Set *FRAME to the actual frame. */
1344 1304
1345static Lisp_Object 1305static Lisp_Object
1346check_fontset_name (name, frame) 1306check_fontset_name (Lisp_Object name, Lisp_Object *frame)
1347 Lisp_Object name, *frame;
1348{ 1307{
1349 int id; 1308 int id;
1350 1309
@@ -1373,8 +1332,7 @@ check_fontset_name (name, frame)
1373} 1332}
1374 1333
1375static void 1334static void
1376accumulate_script_ranges (arg, range, val) 1335accumulate_script_ranges (Lisp_Object arg, Lisp_Object range, Lisp_Object val)
1377 Lisp_Object arg, range, val;
1378{ 1336{
1379 if (EQ (XCAR (arg), val)) 1337 if (EQ (XCAR (arg), val))
1380 { 1338 {
@@ -1399,8 +1357,7 @@ accumulate_script_ranges (arg, range, val)
1399 case. */ 1357 case. */
1400 1358
1401static void 1359static void
1402set_fontset_font (arg, range) 1360set_fontset_font (Lisp_Object arg, Lisp_Object range)
1403 Lisp_Object arg, range;
1404{ 1361{
1405 Lisp_Object fontset, font_def, add, ascii, script_range_list; 1362 Lisp_Object fontset, font_def, add, ascii, script_range_list;
1406 int from = XINT (XCAR (range)), to = XINT (XCDR (range)); 1363 int from = XINT (XCAR (range)), to = XINT (XCDR (range));
@@ -1762,8 +1719,7 @@ static int num_auto_fontsets;
1762 user intends to use FONT-OBJECT for Latin characters. */ 1719 user intends to use FONT-OBJECT for Latin characters. */
1763 1720
1764int 1721int
1765fontset_from_font (font_object) 1722fontset_from_font (Lisp_Object font_object)
1766 Lisp_Object font_object;
1767{ 1723{
1768 Lisp_Object font_name = font_get_name (font_object); 1724 Lisp_Object font_name = font_get_name (font_object);
1769 Lisp_Object font_spec = Fcopy_font_spec (font_object); 1725 Lisp_Object font_spec = Fcopy_font_spec (font_object);
@@ -1819,8 +1775,7 @@ fontset_from_font (font_object)
1819 fontset_from_font. */ 1775 fontset_from_font. */
1820 1776
1821static void 1777static void
1822update_auto_fontset_alist (font_object, fontset) 1778update_auto_fontset_alist (Lisp_Object font_object, Lisp_Object fontset)
1823 Lisp_Object font_object, fontset;
1824{ 1779{
1825 Lisp_Object prev, tail; 1780 Lisp_Object prev, tail;
1826 1781
@@ -2224,7 +2179,7 @@ DEFUN ("fontset-list-all", Ffontset_list_all, Sfontset_list_all, 0, 0, 0,
2224#endif /* FONTSET_DEBUG */ 2179#endif /* FONTSET_DEBUG */
2225 2180
2226void 2181void
2227syms_of_fontset () 2182syms_of_fontset (void)
2228{ 2183{
2229 DEFSYM (Qfontset, "fontset"); 2184 DEFSYM (Qfontset, "fontset");
2230 Fput (Qfontset, Qchar_table_extra_slots, make_number (9)); 2185 Fput (Qfontset, Qchar_table_extra_slots, make_number (9));