Mercurial > emacs
comparison src/fontset.c @ 95230:fa14617b247e
Delete unused variables and add casting for char *
throughout the file.
(fontset_font): Try the fallback fonts of the current fontset
before consulting the default fontset.
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Fri, 23 May 2008 02:21:30 +0000 |
parents | a6a4ada91449 |
children | 993b2f1f702e |
comparison
equal
deleted
inserted
replaced
95229:38cbd89dd626 | 95230:fa14617b247e |
---|---|
576 } | 576 } |
577 | 577 |
578 /* Find the first available font in the vector of RFONT-DEF. */ | 578 /* Find the first available font in the vector of RFONT-DEF. */ |
579 for (; i < ASIZE (vec); i++) | 579 for (; i < ASIZE (vec); i++) |
580 { | 580 { |
581 Lisp_Object font_def, font_entity, font_object; | 581 Lisp_Object font_entity, font_object; |
582 | 582 |
583 elt = AREF (vec, i); | 583 elt = AREF (vec, i); |
584 if (NILP (elt)) | 584 if (NILP (elt)) |
585 /* This is the sign of not to try fallback fonts. */ | 585 /* This is the sign of not to try fallback fonts. */ |
586 return Qt; | 586 return Qt; |
681 rfont_def = fontset_find_font (fontset, c, face, id, 0); | 681 rfont_def = fontset_find_font (fontset, c, face, id, 0); |
682 if (VECTORP (rfont_def)) | 682 if (VECTORP (rfont_def)) |
683 return rfont_def; | 683 return rfont_def; |
684 if (EQ (rfont_def, Qt)) | 684 if (EQ (rfont_def, Qt)) |
685 return Qnil; | 685 return Qnil; |
686 base_fontset = FONTSET_BASE (fontset); | |
687 /* Try a font-group for C of the default fontset. */ | |
688 if (! EQ (base_fontset, Vdefault_fontset)) | |
689 { | |
690 if (NILP (FONTSET_DEFAULT (fontset))) | |
691 FONTSET_DEFAULT (fontset) | |
692 = make_fontset (FONTSET_FRAME (fontset), Qnil, Vdefault_fontset); | |
693 rfont_def = fontset_find_font (FONTSET_DEFAULT (fontset), c, face, id, 0); | |
694 if (VECTORP (rfont_def)) | |
695 return (rfont_def); | |
696 } | |
697 | |
698 /* Try a fallback font-group. */ | 686 /* Try a fallback font-group. */ |
699 rfont_def = fontset_find_font (fontset, c, face, id, 1); | 687 rfont_def = fontset_find_font (fontset, c, face, id, 1); |
700 if (! VECTORP (rfont_def) | 688 if (VECTORP (rfont_def)) |
701 && ! EQ (base_fontset, Vdefault_fontset)) | 689 return rfont_def; |
702 /* Try a fallback font-group of the default fontset . */ | 690 if (EQ (rfont_def, Qt)) |
703 rfont_def = fontset_find_font (FONTSET_DEFAULT (fontset), c, face, id, 1); | 691 return Qnil; |
704 | 692 |
693 base_fontset = FONTSET_BASE (fontset); | |
694 if (EQ (base_fontset, Vdefault_fontset)) | |
695 return Qnil; | |
696 | |
697 /* Try a font-group for C of the default fontset. */ | |
698 if (NILP (FONTSET_DEFAULT (fontset))) | |
699 FONTSET_DEFAULT (fontset) | |
700 = make_fontset (FONTSET_FRAME (fontset), Qnil, Vdefault_fontset); | |
701 rfont_def = fontset_find_font (FONTSET_DEFAULT (fontset), c, face, id, 0); | |
702 if (VECTORP (rfont_def)) | |
703 return rfont_def; | |
704 /* Try a fallback font-group of the default fontset . */ | |
705 rfont_def = fontset_find_font (FONTSET_DEFAULT (fontset), c, face, id, 1); | |
705 if (! VECTORP (rfont_def)) | 706 if (! VECTORP (rfont_def)) |
706 /* Remeber that we have no font for C. */ | 707 /* Remeber that we have no font for C. */ |
707 FONTSET_SET (fontset, make_number (c), Qt); | 708 FONTSET_SET (fontset, make_number (c), Qt); |
708 | 709 |
709 return rfont_def; | 710 return rfont_def; |
970 /* Cache data used by fontset_pattern_regexp. The car part is a | 971 /* Cache data used by fontset_pattern_regexp. The car part is a |
971 pattern string containing at least one wild card, the cdr part is | 972 pattern string containing at least one wild card, the cdr part is |
972 the corresponding regular expression. */ | 973 the corresponding regular expression. */ |
973 static Lisp_Object Vcached_fontset_data; | 974 static Lisp_Object Vcached_fontset_data; |
974 | 975 |
975 #define CACHED_FONTSET_NAME (SDATA (XCAR (Vcached_fontset_data))) | 976 #define CACHED_FONTSET_NAME ((char *) SDATA (XCAR (Vcached_fontset_data))) |
976 #define CACHED_FONTSET_REGEX (XCDR (Vcached_fontset_data)) | 977 #define CACHED_FONTSET_REGEX (XCDR (Vcached_fontset_data)) |
977 | 978 |
978 /* If fontset name PATTERN contains any wild card, return regular | 979 /* If fontset name PATTERN contains any wild card, return regular |
979 expression corresponding to PATTERN. */ | 980 expression corresponding to PATTERN. */ |
980 | 981 |
981 static Lisp_Object | 982 static Lisp_Object |
982 fontset_pattern_regexp (pattern) | 983 fontset_pattern_regexp (pattern) |
983 Lisp_Object pattern; | 984 Lisp_Object pattern; |
984 { | 985 { |
985 if (!index (SDATA (pattern), '*') | 986 if (!index ((char *) SDATA (pattern), '*') |
986 && !index (SDATA (pattern), '?')) | 987 && !index ((char *) SDATA (pattern), '?')) |
987 /* PATTERN does not contain any wild cards. */ | 988 /* PATTERN does not contain any wild cards. */ |
988 return Qnil; | 989 return Qnil; |
989 | 990 |
990 if (!CONSP (Vcached_fontset_data) | 991 if (!CONSP (Vcached_fontset_data) |
991 || strcmp (SDATA (pattern), CACHED_FONTSET_NAME)) | 992 || strcmp ((char *) SDATA (pattern), CACHED_FONTSET_NAME)) |
992 { | 993 { |
993 /* We must at first update the cached data. */ | 994 /* We must at first update the cached data. */ |
994 unsigned char *regex, *p0, *p1; | 995 unsigned char *regex, *p0, *p1; |
995 int ndashes = 0, nstars = 0; | 996 int ndashes = 0, nstars = 0; |
996 | 997 |
1027 *p1++ = *p0; | 1028 *p1++ = *p0; |
1028 } | 1029 } |
1029 *p1++ = '$'; | 1030 *p1++ = '$'; |
1030 *p1++ = 0; | 1031 *p1++ = 0; |
1031 | 1032 |
1032 Vcached_fontset_data = Fcons (build_string (SDATA (pattern)), | 1033 Vcached_fontset_data = Fcons (build_string ((char *) SDATA (pattern)), |
1033 build_string (regex)); | 1034 build_string ((char *) regex)); |
1034 } | 1035 } |
1035 | 1036 |
1036 return CACHED_FONTSET_REGEX; | 1037 return CACHED_FONTSET_REGEX; |
1037 } | 1038 } |
1038 | 1039 |
1143 continue; | 1144 continue; |
1144 name = FONTSET_NAME (fontset); | 1145 name = FONTSET_NAME (fontset); |
1145 | 1146 |
1146 if (STRINGP (regexp) | 1147 if (STRINGP (regexp) |
1147 ? (fast_string_match (regexp, name) < 0) | 1148 ? (fast_string_match (regexp, name) < 0) |
1148 : strcmp (SDATA (pattern), SDATA (name))) | 1149 : strcmp ((char *) SDATA (pattern), (char *) SDATA (name))) |
1149 continue; | 1150 continue; |
1150 | 1151 |
1151 val = Fcons (Fcopy_sequence (FONTSET_NAME (fontset)), val); | 1152 val = Fcons (Fcopy_sequence (FONTSET_NAME (fontset)), val); |
1152 } | 1153 } |
1153 | 1154 |
1251 static INLINE Lisp_Object | 1252 static INLINE Lisp_Object |
1252 generate_ascii_font_name (name, ascii_spec) | 1253 generate_ascii_font_name (name, ascii_spec) |
1253 Lisp_Object name, ascii_spec; | 1254 Lisp_Object name, ascii_spec; |
1254 { | 1255 { |
1255 Lisp_Object font_spec = Ffont_spec (0, NULL); | 1256 Lisp_Object font_spec = Ffont_spec (0, NULL); |
1256 Lisp_Object vec; | |
1257 int i; | 1257 int i; |
1258 char xlfd[256]; | 1258 char xlfd[256]; |
1259 | 1259 |
1260 if (font_parse_xlfd (SDATA (name), font_spec) < 0) | 1260 if (font_parse_xlfd ((char *) SDATA (name), font_spec) < 0) |
1261 error ("Not an XLFD font name: %s", SDATA (name)); | 1261 error ("Not an XLFD font name: %s", SDATA (name)); |
1262 for (i = FONT_FOUNDRY_INDEX; i < FONT_EXTRA_INDEX; i++) | 1262 for (i = FONT_FOUNDRY_INDEX; i < FONT_EXTRA_INDEX; i++) |
1263 if (! NILP (AREF (ascii_spec, i))) | 1263 if (! NILP (AREF (ascii_spec, i))) |
1264 ASET (font_spec, i, AREF (ascii_spec, i)); | 1264 ASET (font_spec, i, AREF (ascii_spec, i)); |
1265 i = font_unparse_xlfd (font_spec, 0, xlfd, 256); | 1265 i = font_unparse_xlfd (font_spec, 0, xlfd, 256); |
1517 `set-fontset-font' for the meaning. */) | 1517 `set-fontset-font' for the meaning. */) |
1518 (name, fontlist) | 1518 (name, fontlist) |
1519 Lisp_Object name, fontlist; | 1519 Lisp_Object name, fontlist; |
1520 { | 1520 { |
1521 Lisp_Object fontset; | 1521 Lisp_Object fontset; |
1522 Lisp_Object val; | |
1523 int id; | 1522 int id; |
1524 | 1523 |
1525 CHECK_STRING (name); | 1524 CHECK_STRING (name); |
1526 CHECK_LIST (fontlist); | 1525 CHECK_LIST (fontlist); |
1527 | 1526 |
1532 Lisp_Object font_spec = Ffont_spec (0, NULL); | 1531 Lisp_Object font_spec = Ffont_spec (0, NULL); |
1533 Lisp_Object short_name; | 1532 Lisp_Object short_name; |
1534 char xlfd[256]; | 1533 char xlfd[256]; |
1535 int len; | 1534 int len; |
1536 | 1535 |
1537 if (font_parse_xlfd (SDATA (name), font_spec) < 0) | 1536 if (font_parse_xlfd ((char *) SDATA (name), font_spec) < 0) |
1538 error ("Fontset name must be in XLFD format"); | 1537 error ("Fontset name must be in XLFD format"); |
1539 short_name = AREF (font_spec, FONT_REGISTRY_INDEX); | 1538 short_name = AREF (font_spec, FONT_REGISTRY_INDEX); |
1540 if (strncmp (SDATA (SYMBOL_NAME (short_name)), "fontset-", 8) | 1539 if (strncmp ((char *) SDATA (SYMBOL_NAME (short_name)), "fontset-", 8) |
1541 || SBYTES (SYMBOL_NAME (short_name)) < 9) | 1540 || SBYTES (SYMBOL_NAME (short_name)) < 9) |
1542 error ("Registry field of fontset name must be \"fontset-*\""); | 1541 error ("Registry field of fontset name must be \"fontset-*\""); |
1543 Vfontset_alias_alist = Fcons (Fcons (name, SYMBOL_NAME (short_name)), | 1542 Vfontset_alias_alist = Fcons (Fcons (name, SYMBOL_NAME (short_name)), |
1544 Vfontset_alias_alist); | 1543 Vfontset_alias_alist); |
1545 ASET (font_spec, FONT_REGISTRY_INDEX, Qiso8859_1); | 1544 ASET (font_spec, FONT_REGISTRY_INDEX, Qiso8859_1); |
1652 if (NILP (frame)) | 1651 if (NILP (frame)) |
1653 frame = selected_frame; | 1652 frame = selected_frame; |
1654 CHECK_LIVE_FRAME (frame); | 1653 CHECK_LIVE_FRAME (frame); |
1655 f = XFRAME (frame); | 1654 f = XFRAME (frame); |
1656 | 1655 |
1657 font_object = font_open_by_name (f, SDATA (name)); | 1656 font_object = font_open_by_name (f, (char *) SDATA (name)); |
1658 if (NILP (font_object)) | 1657 if (NILP (font_object)) |
1659 return Qnil; | 1658 return Qnil; |
1660 font = XFONT_OBJECT (font_object); | 1659 font = XFONT_OBJECT (font_object); |
1661 | 1660 |
1662 info = Fmake_vector (make_number (7), Qnil); | 1661 info = Fmake_vector (make_number (7), Qnil); |
1708 EMACS_INT pos, pos_byte, dummy; | 1707 EMACS_INT pos, pos_byte, dummy; |
1709 int face_id; | 1708 int face_id; |
1710 int c; | 1709 int c; |
1711 struct frame *f; | 1710 struct frame *f; |
1712 struct face *face; | 1711 struct face *face; |
1713 Lisp_Object rfont_def; | |
1714 int cs_id; | 1712 int cs_id; |
1715 | 1713 |
1716 if (NILP (position)) | 1714 if (NILP (position)) |
1717 { | 1715 { |
1718 CHECK_CHARACTER (ch); | 1716 CHECK_CHARACTER (ch); |