diff options
| author | Kenichi Handa | 2002-08-23 02:26:44 +0000 |
|---|---|---|
| committer | Kenichi Handa | 2002-08-23 02:26:44 +0000 |
| commit | 763bc839f174e63beb51b0c1d34cabb5b7d64a20 (patch) | |
| tree | d579dc8ec94c9073aa485cfd7c84cbf5677ce0bb /src | |
| parent | 680d4b87f3d88a8b79f883cf3635036747588250 (diff) | |
| download | emacs-763bc839f174e63beb51b0c1d34cabb5b7d64a20.tar.gz emacs-763bc839f174e63beb51b0c1d34cabb5b7d64a20.zip | |
(QCfontset): New variable.
(LFACE_FONTSET): New macro.
(check_lface_attrs): Check also LFACE_FONTSET_INDEX.
(set_lface_from_font_name): Setup LFACE_FONTSET (lface).
(Finternal_set_lisp_face_attribute): Handle QCfontset.
(Finternal_get_lisp_face_attribute): Likewise.
(lface_same_font_attributes_p): Fix checking of LFACE_FONT_INDEX,
check also LFACE_FONTSET_INDEX.
(face_fontset): Check attrs[LFACE_FONTSET_INDEX], not
attrs[LFACE_FONT_INDEX].
(syms_of_xfaces): Intern and staticpro QCfontset.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xfaces.c | 59 |
1 files changed, 44 insertions, 15 deletions
diff --git a/src/xfaces.c b/src/xfaces.c index eac3ee92c05..166f94a761f 100644 --- a/src/xfaces.c +++ b/src/xfaces.c | |||
| @@ -56,7 +56,7 @@ Boston, MA 02111-1307, USA. */ | |||
| 56 | 13. Whether or not a box should be drawn around characters, the box | 56 | 13. Whether or not a box should be drawn around characters, the box |
| 57 | type, and, for simple boxes, in what color. | 57 | type, and, for simple boxes, in what color. |
| 58 | 58 | ||
| 59 | 14. Font or fontset pattern, or nil. This is a special attribute. | 59 | 14. Font pattern, or nil. This is a special attribute. |
| 60 | When this attribute is specified, the face uses a font opened by | 60 | When this attribute is specified, the face uses a font opened by |
| 61 | that pattern as is. In addition, all the other font-related | 61 | that pattern as is. In addition, all the other font-related |
| 62 | attributes (1st thru 5th) are generated from the opened font name. | 62 | attributes (1st thru 5th) are generated from the opened font name. |
| @@ -72,6 +72,8 @@ Boston, MA 02111-1307, USA. */ | |||
| 72 | and is used to ensure that a font specified on the command line, | 72 | and is used to ensure that a font specified on the command line, |
| 73 | for example, can be matched exactly. | 73 | for example, can be matched exactly. |
| 74 | 74 | ||
| 75 | 17. A fontset name. | ||
| 76 | |||
| 75 | Faces are frame-local by nature because Emacs allows to define the | 77 | Faces are frame-local by nature because Emacs allows to define the |
| 76 | same named face (face names are symbols) differently for different | 78 | same named face (face names are symbols) differently for different |
| 77 | frames. Each frame has an alist of face definitions for all named | 79 | frames. Each frame has an alist of face definitions for all named |
| @@ -123,7 +125,7 @@ Boston, MA 02111-1307, USA. */ | |||
| 123 | is realized, it inherits (thus shares) a fontset of an ASCII face | 125 | is realized, it inherits (thus shares) a fontset of an ASCII face |
| 124 | that has the same attributes other than font-related ones. | 126 | that has the same attributes other than font-related ones. |
| 125 | 127 | ||
| 126 | Thus, all realized face have a realized fontset. | 128 | Thus, all realized faces have a realized fontset. |
| 127 | 129 | ||
| 128 | 130 | ||
| 129 | Unibyte text. | 131 | Unibyte text. |
| @@ -341,6 +343,7 @@ Lisp_Object QCinverse_video, QCforeground, QCbackground, QCstipple; | |||
| 341 | Lisp_Object QCwidth, QCfont, QCbold, QCitalic; | 343 | Lisp_Object QCwidth, QCfont, QCbold, QCitalic; |
| 342 | Lisp_Object QCreverse_video; | 344 | Lisp_Object QCreverse_video; |
| 343 | Lisp_Object QCoverline, QCstrike_through, QCbox, QCinherit; | 345 | Lisp_Object QCoverline, QCstrike_through, QCbox, QCinherit; |
| 346 | Lisp_Object QCfontset; | ||
| 344 | 347 | ||
| 345 | /* Symbols used for attribute values. */ | 348 | /* Symbols used for attribute values. */ |
| 346 | 349 | ||
| @@ -1252,8 +1255,7 @@ frame_update_line_height (f) | |||
| 1252 | #ifdef HAVE_WINDOW_SYSTEM | 1255 | #ifdef HAVE_WINDOW_SYSTEM |
| 1253 | 1256 | ||
| 1254 | /* Load font of face FACE which is used on frame F to display ASCII | 1257 | /* Load font of face FACE which is used on frame F to display ASCII |
| 1255 | characters. The name of the font to load is determined by lface | 1258 | characters. The name of the font to load is determined by lface. */ |
| 1256 | and fontset of FACE. */ | ||
| 1257 | 1259 | ||
| 1258 | static void | 1260 | static void |
| 1259 | load_face_font (f, face) | 1261 | load_face_font (f, face) |
| @@ -2985,6 +2987,7 @@ the WIDTH times as wide as FACE on FRAME. */) | |||
| 2985 | #define LFACE_FONT(LFACE) AREF ((LFACE), LFACE_FONT_INDEX) | 2987 | #define LFACE_FONT(LFACE) AREF ((LFACE), LFACE_FONT_INDEX) |
| 2986 | #define LFACE_INHERIT(LFACE) AREF ((LFACE), LFACE_INHERIT_INDEX) | 2988 | #define LFACE_INHERIT(LFACE) AREF ((LFACE), LFACE_INHERIT_INDEX) |
| 2987 | #define LFACE_AVGWIDTH(LFACE) AREF ((LFACE), LFACE_AVGWIDTH_INDEX) | 2989 | #define LFACE_AVGWIDTH(LFACE) AREF ((LFACE), LFACE_AVGWIDTH_INDEX) |
| 2990 | #define LFACE_FONTSET(LFACE) AREF ((LFACE), LFACE_FONTSET_INDEX) | ||
| 2988 | 2991 | ||
| 2989 | /* Non-zero if LFACE is a Lisp face. A Lisp face is a vector of size | 2992 | /* Non-zero if LFACE is a Lisp face. A Lisp face is a vector of size |
| 2990 | LFACE_VECTOR_SIZE which has the symbol `face' in slot 0. */ | 2993 | LFACE_VECTOR_SIZE which has the symbol `face' in slot 0. */ |
| @@ -3048,6 +3051,8 @@ check_lface_attrs (attrs) | |||
| 3048 | xassert (UNSPECIFIEDP (attrs[LFACE_FONT_INDEX]) | 3051 | xassert (UNSPECIFIEDP (attrs[LFACE_FONT_INDEX]) |
| 3049 | || NILP (attrs[LFACE_FONT_INDEX]) | 3052 | || NILP (attrs[LFACE_FONT_INDEX]) |
| 3050 | || STRINGP (attrs[LFACE_FONT_INDEX])); | 3053 | || STRINGP (attrs[LFACE_FONT_INDEX])); |
| 3054 | xassert (UNSPECIFIEDP (attrs[LFACE_FONTSET_INDEX]) | ||
| 3055 | || STRINGP (attrs[LFACE_FONTSET_INDEX])); | ||
| 3051 | #endif | 3056 | #endif |
| 3052 | } | 3057 | } |
| 3053 | 3058 | ||
| @@ -3286,8 +3291,13 @@ set_lface_from_font_name (f, lface, fontname, force_p, may_fail_p) | |||
| 3286 | LFACE_SLANT (lface) | 3291 | LFACE_SLANT (lface) |
| 3287 | = have_xlfd_p ? xlfd_symbolic_slant (&font) : Qnormal; | 3292 | = have_xlfd_p ? xlfd_symbolic_slant (&font) : Qnormal; |
| 3288 | 3293 | ||
| 3289 | LFACE_FONT (lface) = fontname; | 3294 | if (fontset) |
| 3290 | 3295 | { | |
| 3296 | LFACE_FONT (lface) = build_string (font_info->full_name); | ||
| 3297 | LFACE_FONTSET (lface) = fontset_name (fontset); | ||
| 3298 | } | ||
| 3299 | else | ||
| 3300 | LFACE_FONT (lface) = fontname; | ||
| 3291 | return 1; | 3301 | return 1; |
| 3292 | } | 3302 | } |
| 3293 | 3303 | ||
| @@ -4124,7 +4134,7 @@ FRAME 0 means change the face on all frames, and change the default | |||
| 4124 | LFACE_SWIDTH (lface) = value; | 4134 | LFACE_SWIDTH (lface) = value; |
| 4125 | font_related_attr_p = 1; | 4135 | font_related_attr_p = 1; |
| 4126 | } | 4136 | } |
| 4127 | else if (EQ (attr, QCfont)) | 4137 | else if (EQ (attr, QCfont) || EQ (attr, QCfontset)) |
| 4128 | { | 4138 | { |
| 4129 | #ifdef HAVE_WINDOW_SYSTEM | 4139 | #ifdef HAVE_WINDOW_SYSTEM |
| 4130 | if (FRAME_WINDOW_P (XFRAME (frame))) | 4140 | if (FRAME_WINDOW_P (XFRAME (frame))) |
| @@ -4145,9 +4155,16 @@ FRAME 0 means change the face on all frames, and change the default | |||
| 4145 | tmp = Fquery_fontset (value, Qnil); | 4155 | tmp = Fquery_fontset (value, Qnil); |
| 4146 | if (!NILP (tmp)) | 4156 | if (!NILP (tmp)) |
| 4147 | value = tmp; | 4157 | value = tmp; |
| 4158 | else if (EQ (attr, QCfontset)) | ||
| 4159 | error ("Invalid fontset", XSTRING (value)->data); | ||
| 4148 | 4160 | ||
| 4149 | if (!set_lface_from_font_name (f, lface, value, 1, 1)) | 4161 | if (EQ (attr, QCfont)) |
| 4150 | signal_error ("Invalid font or fontset name", value); | 4162 | { |
| 4163 | if (!set_lface_from_font_name (f, lface, value, 1, 1)) | ||
| 4164 | signal_error ("Invalid font or fontset name", value); | ||
| 4165 | } | ||
| 4166 | else | ||
| 4167 | LFACE_FONTSET (lface) = value; | ||
| 4151 | 4168 | ||
| 4152 | font_attr_p = 1; | 4169 | font_attr_p = 1; |
| 4153 | } | 4170 | } |
| @@ -4197,6 +4214,7 @@ FRAME 0 means change the face on all frames, and change the default | |||
| 4197 | init_iterator will then free realized faces. */ | 4214 | init_iterator will then free realized faces. */ |
| 4198 | if (!EQ (frame, Qt) | 4215 | if (!EQ (frame, Qt) |
| 4199 | && (EQ (attr, QCfont) | 4216 | && (EQ (attr, QCfont) |
| 4217 | || EQ (attr, QCfontset) | ||
| 4200 | || NILP (Fequal (old_value, value)))) | 4218 | || NILP (Fequal (old_value, value)))) |
| 4201 | { | 4219 | { |
| 4202 | ++face_change_count; | 4220 | ++face_change_count; |
| @@ -4304,7 +4322,7 @@ FRAME 0 means change the face on all frames, and change the default | |||
| 4304 | #ifdef HAVE_WINDOW_SYSTEM | 4322 | #ifdef HAVE_WINDOW_SYSTEM |
| 4305 | 4323 | ||
| 4306 | /* Set the `font' frame parameter of FRAME determined from `default' | 4324 | /* Set the `font' frame parameter of FRAME determined from `default' |
| 4307 | face attributes LFACE. If a face or fontset name is explicitely | 4325 | face attributes LFACE. If a font name is explicitely |
| 4308 | specfied in LFACE, use it as is. Otherwise, determine a font name | 4326 | specfied in LFACE, use it as is. Otherwise, determine a font name |
| 4309 | from the other font-related atrributes of LFACE. In that case, if | 4327 | from the other font-related atrributes of LFACE. In that case, if |
| 4310 | there's no matching font, signals an error. */ | 4328 | there's no matching font, signals an error. */ |
| @@ -4680,6 +4698,8 @@ frames). If FRAME is omitted or nil, use the selected frame. */) | |||
| 4680 | value = LFACE_INHERIT (lface); | 4698 | value = LFACE_INHERIT (lface); |
| 4681 | else if (EQ (keyword, QCfont)) | 4699 | else if (EQ (keyword, QCfont)) |
| 4682 | value = LFACE_FONT (lface); | 4700 | value = LFACE_FONT (lface); |
| 4701 | else if (EQ (keyword, QCfontset)) | ||
| 4702 | value = LFACE_FONTSET (lface); | ||
| 4683 | else | 4703 | else |
| 4684 | signal_error ("Invalid face attribute name", keyword); | 4704 | signal_error ("Invalid face attribute name", keyword); |
| 4685 | 4705 | ||
| @@ -4966,8 +4986,8 @@ lface_hash (v) | |||
| 4966 | 4986 | ||
| 4967 | /* Return non-zero if LFACE1 and LFACE2 specify the same font (without | 4987 | /* Return non-zero if LFACE1 and LFACE2 specify the same font (without |
| 4968 | considering charsets/registries). They do if they specify the same | 4988 | considering charsets/registries). They do if they specify the same |
| 4969 | family, point size, weight, width, slant, and fontset. Both LFACE1 | 4989 | family, point size, weight, width, slant, font, and fontset. Both |
| 4970 | and LFACE2 must be fully-specified. */ | 4990 | LFACE1 and LFACE2 must be fully-specified. */ |
| 4971 | 4991 | ||
| 4972 | static INLINE int | 4992 | static INLINE int |
| 4973 | lface_same_font_attributes_p (lface1, lface2) | 4993 | lface_same_font_attributes_p (lface1, lface2) |
| @@ -4985,8 +5005,14 @@ lface_same_font_attributes_p (lface1, lface2) | |||
| 4985 | && (EQ (lface1[LFACE_FONT_INDEX], lface2[LFACE_FONT_INDEX]) | 5005 | && (EQ (lface1[LFACE_FONT_INDEX], lface2[LFACE_FONT_INDEX]) |
| 4986 | || (STRINGP (lface1[LFACE_FONT_INDEX]) | 5006 | || (STRINGP (lface1[LFACE_FONT_INDEX]) |
| 4987 | && STRINGP (lface2[LFACE_FONT_INDEX]) | 5007 | && STRINGP (lface2[LFACE_FONT_INDEX]) |
| 4988 | && xstricmp (XSTRING (lface1[LFACE_FONT_INDEX])->data, | 5008 | && ! xstricmp (XSTRING (lface1[LFACE_FONT_INDEX])->data, |
| 4989 | XSTRING (lface2[LFACE_FONT_INDEX])->data)))); | 5009 | XSTRING (lface2[LFACE_FONT_INDEX])->data))) |
| 5010 | && (EQ (lface1[LFACE_FONTSET_INDEX], lface2[LFACE_FONTSET_INDEX]) | ||
| 5011 | || (STRINGP (lface1[LFACE_FONTSET_INDEX]) | ||
| 5012 | && STRINGP (lface2[LFACE_FONTSET_INDEX]) | ||
| 5013 | && ! xstricmp (XSTRING (lface1[LFACE_FONTSET_INDEX])->data, | ||
| 5014 | XSTRING (lface2[LFACE_FONTSET_INDEX])->data))) | ||
| 5015 | ); | ||
| 4990 | } | 5016 | } |
| 4991 | 5017 | ||
| 4992 | 5018 | ||
| @@ -6167,8 +6193,9 @@ face_fontset (attrs) | |||
| 6167 | Lisp_Object *attrs; | 6193 | Lisp_Object *attrs; |
| 6168 | { | 6194 | { |
| 6169 | Lisp_Object name; | 6195 | Lisp_Object name; |
| 6196 | int fontset; | ||
| 6170 | 6197 | ||
| 6171 | name = attrs[LFACE_FONT_INDEX]; | 6198 | name = attrs[LFACE_FONTSET_INDEX]; |
| 6172 | if (!STRINGP (name)) | 6199 | if (!STRINGP (name)) |
| 6173 | return -1; | 6200 | return -1; |
| 6174 | return fs_query_fontset (name, 0); | 6201 | return fs_query_fontset (name, 0); |
| @@ -7288,6 +7315,8 @@ syms_of_xfaces () | |||
| 7288 | staticpro (&QCwidth); | 7315 | staticpro (&QCwidth); |
| 7289 | QCfont = intern (":font"); | 7316 | QCfont = intern (":font"); |
| 7290 | staticpro (&QCfont); | 7317 | staticpro (&QCfont); |
| 7318 | QCfontset = intern (":fontset"); | ||
| 7319 | staticpro (&QCfontset); | ||
| 7291 | QCbold = intern (":bold"); | 7320 | QCbold = intern (":bold"); |
| 7292 | staticpro (&QCbold); | 7321 | staticpro (&QCbold); |
| 7293 | QCitalic = intern (":italic"); | 7322 | QCitalic = intern (":italic"); |