aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKenichi Handa2008-06-13 02:08:52 +0000
committerKenichi Handa2008-06-13 02:08:52 +0000
commit53aaf1e22f415b058b27ebd2c0c3f97727d54bcd (patch)
tree4f22da2694506fad525e092bf3b77ad387e05977 /src
parente4fe6f9f213df355e8a7360388a650454ac8ffc6 (diff)
downloademacs-53aaf1e22f415b058b27ebd2c0c3f97727d54bcd.tar.gz
emacs-53aaf1e22f415b058b27ebd2c0c3f97727d54bcd.zip
(LFACE_FOUNDRY): New macro.
(check_lface_attrs): Check foundry. (set_lface_from_font): Don't parse "FOUNDRY-FAMILY" from. (merge_face_vectors): Check foundry. (merge_face_ref): Likewise. (Finternal_set_lisp_face_attribute): Likewise. (x_update_menu_appearance): Likewise. (Finternal_get_lisp_face_attribute): Likewise. (lface_hash): Likewise. (lface_same_font_attributes_p): Likewise. (x_supports_face_attributes_p): Likewise. (tty_supports_face_attributes_p): Likewise. (Finternal_set_alternative_font_family_alist): Intern strings. (Finternal_set_alternative_font_registry_alist): Downcase strings. (realize_default_face): Set LFACE_FOUNDRY (lface).
Diffstat (limited to 'src')
-rw-r--r--src/xfaces.c102
1 files changed, 71 insertions, 31 deletions
diff --git a/src/xfaces.c b/src/xfaces.c
index 7f64618b53e..51da48be48f 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -27,34 +27,36 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
27 27
28 1. Font family name. 28 1. Font family name.
29 29
30 2. Relative proportionate width, aka character set width or set 30 2. Font foundary name.
31
32 3. Relative proportionate width, aka character set width or set
31 width (swidth), e.g. `semi-compressed'. 33 width (swidth), e.g. `semi-compressed'.
32 34
33 3. Font height in 1/10pt. 35 4. Font height in 1/10pt.
34 36
35 4. Font weight, e.g. `bold'. 37 5. Font weight, e.g. `bold'.
36 38
37 5. Font slant, e.g. `italic'. 39 6. Font slant, e.g. `italic'.
38 40
39 6. Foreground color. 41 7. Foreground color.
40 42
41 7. Background color. 43 8. Background color.
42 44
43 8. Whether or not characters should be underlined, and in what color. 45 9. Whether or not characters should be underlined, and in what color.
44 46
45 9. Whether or not characters should be displayed in inverse video. 47 10. Whether or not characters should be displayed in inverse video.
46 48
47 10. A background stipple, a bitmap. 49 11. A background stipple, a bitmap.
48 50
49 11. Whether or not characters should be overlined, and in what color. 51 12. Whether or not characters should be overlined, and in what color.
50 52
51 12. Whether or not characters should be strike-through, and in what 53 13. Whether or not characters should be strike-through, and in what
52 color. 54 color.
53 55
54 13. Whether or not a box should be drawn around characters, the box 56 14. Whether or not a box should be drawn around characters, the box
55 type, and, for simple boxes, in what color. 57 type, and, for simple boxes, in what color.
56 58
57 14. Font-spec, or nil. This is a special attribute. 59 15. Font-spec, or nil. This is a special attribute.
58 60
59 A font-spec is a collection of font attributes (specs). 61 A font-spec is a collection of font attributes (specs).
60 62
@@ -513,7 +515,6 @@ static void set_font_frame_param P_ ((Lisp_Object, Lisp_Object));
513static int get_lface_attributes P_ ((struct frame *, Lisp_Object, Lisp_Object *, 515static int get_lface_attributes P_ ((struct frame *, Lisp_Object, Lisp_Object *,
514 int, struct named_merge_point *)); 516 int, struct named_merge_point *));
515static int load_pixmap P_ ((struct frame *, Lisp_Object, unsigned *, unsigned *)); 517static int load_pixmap P_ ((struct frame *, Lisp_Object, unsigned *, unsigned *));
516static unsigned char *xstrlwr P_ ((unsigned char *));
517static struct frame *frame_or_selected_frame P_ ((Lisp_Object, int)); 518static struct frame *frame_or_selected_frame P_ ((Lisp_Object, int));
518static void load_face_colors P_ ((struct frame *, struct face *, Lisp_Object *)); 519static void load_face_colors P_ ((struct frame *, struct face *, Lisp_Object *));
519static void free_face_colors P_ ((struct frame *, struct face *)); 520static void free_face_colors P_ ((struct frame *, struct face *));
@@ -1961,6 +1962,7 @@ the WIDTH times as wide as FACE on FRAME. */)
1961/* Access face attributes of face LFACE, a Lisp vector. */ 1962/* Access face attributes of face LFACE, a Lisp vector. */
1962 1963
1963#define LFACE_FAMILY(LFACE) AREF ((LFACE), LFACE_FAMILY_INDEX) 1964#define LFACE_FAMILY(LFACE) AREF ((LFACE), LFACE_FAMILY_INDEX)
1965#define LFACE_FOUNDRY(LFACE) AREF ((LFACE), LFACE_FOUNDRY_INDEX)
1964#define LFACE_HEIGHT(LFACE) AREF ((LFACE), LFACE_HEIGHT_INDEX) 1966#define LFACE_HEIGHT(LFACE) AREF ((LFACE), LFACE_HEIGHT_INDEX)
1965#define LFACE_WEIGHT(LFACE) AREF ((LFACE), LFACE_WEIGHT_INDEX) 1967#define LFACE_WEIGHT(LFACE) AREF ((LFACE), LFACE_WEIGHT_INDEX)
1966#define LFACE_SLANT(LFACE) AREF ((LFACE), LFACE_SLANT_INDEX) 1968#define LFACE_SLANT(LFACE) AREF ((LFACE), LFACE_SLANT_INDEX)
@@ -1997,6 +1999,9 @@ check_lface_attrs (attrs)
1997 xassert (UNSPECIFIEDP (attrs[LFACE_FAMILY_INDEX]) 1999 xassert (UNSPECIFIEDP (attrs[LFACE_FAMILY_INDEX])
1998 || IGNORE_DEFFACE_P (attrs[LFACE_FAMILY_INDEX]) 2000 || IGNORE_DEFFACE_P (attrs[LFACE_FAMILY_INDEX])
1999 || STRINGP (attrs[LFACE_FAMILY_INDEX])); 2001 || STRINGP (attrs[LFACE_FAMILY_INDEX]));
2002 xassert (UNSPECIFIEDP (attrs[LFACE_FOUNDRY_INDEX])
2003 || IGNORE_DEFFACE_P (attrs[LFACE_FOUNDRY_INDEX])
2004 || STRINGP (attrs[LFACE_FOUNDRY_INDEX]));
2000 xassert (UNSPECIFIEDP (attrs[LFACE_SWIDTH_INDEX]) 2005 xassert (UNSPECIFIEDP (attrs[LFACE_SWIDTH_INDEX])
2001 || IGNORE_DEFFACE_P (attrs[LFACE_SWIDTH_INDEX]) 2006 || IGNORE_DEFFACE_P (attrs[LFACE_SWIDTH_INDEX])
2002 || SYMBOLP (attrs[LFACE_SWIDTH_INDEX])); 2007 || SYMBOLP (attrs[LFACE_SWIDTH_INDEX]));
@@ -2366,25 +2371,16 @@ set_lface_from_font (f, lface, font_object, force_p)
2366 2371
2367 if (force_p || UNSPECIFIEDP (LFACE_FAMILY (lface))) 2372 if (force_p || UNSPECIFIEDP (LFACE_FAMILY (lface)))
2368 { 2373 {
2369 Lisp_Object foundry = AREF (font_object, FONT_FOUNDRY_INDEX);
2370 Lisp_Object family = AREF (font_object, FONT_FAMILY_INDEX); 2374 Lisp_Object family = AREF (font_object, FONT_FAMILY_INDEX);
2371 2375
2372 if (! NILP (foundry)) 2376 LFACE_FAMILY (lface) = SYMBOL_NAME (family);
2373 { 2377 }
2374 if (! NILP (family)) 2378
2375 val = concat3 (SYMBOL_NAME (foundry), build_string ("-"), 2379 if (force_p || UNSPECIFIEDP (LFACE_FOUNDRY (lface)))
2376 SYMBOL_NAME (family)); 2380 {
2377 else 2381 Lisp_Object foundry = AREF (font_object, FONT_FOUNDRY_INDEX);
2378 val = concat2 (SYMBOL_NAME (foundry), build_string ("-*")); 2382
2379 } 2383 LFACE_FOUNDRY (lface) = SYMBOL_NAME (foundry);
2380 else
2381 {
2382 if (! NILP (family))
2383 val = SYMBOL_NAME (family);
2384 else
2385 val = build_string ("*");
2386 }
2387 LFACE_FAMILY (lface) = val;
2388 } 2384 }
2389 2385
2390 if (force_p || UNSPECIFIEDP (LFACE_HEIGHT (lface))) 2386 if (force_p || UNSPECIFIEDP (LFACE_HEIGHT (lface)))
@@ -2517,6 +2513,7 @@ merge_face_vectors (f, from, to, named_merge_points)
2517 if (i >= LFACE_FAMILY_INDEX && i <=LFACE_SLANT_INDEX) 2513 if (i >= LFACE_FAMILY_INDEX && i <=LFACE_SLANT_INDEX)
2518 font_clear_prop (to, 2514 font_clear_prop (to,
2519 (i == LFACE_FAMILY_INDEX ? FONT_FAMILY_INDEX 2515 (i == LFACE_FAMILY_INDEX ? FONT_FAMILY_INDEX
2516 : i == LFACE_FOUNDRY_INDEX ? FONT_FOUNDRY_INDEX
2520 : i == LFACE_SWIDTH_INDEX ? FONT_WIDTH_INDEX 2517 : i == LFACE_SWIDTH_INDEX ? FONT_WIDTH_INDEX
2521 : i == LFACE_HEIGHT_INDEX ? FONT_SIZE_INDEX 2518 : i == LFACE_HEIGHT_INDEX ? FONT_SIZE_INDEX
2522 : i == LFACE_WEIGHT_INDEX ? FONT_WEIGHT_INDEX 2519 : i == LFACE_WEIGHT_INDEX ? FONT_WEIGHT_INDEX
@@ -2652,6 +2649,16 @@ merge_face_ref (f, face_ref, to, err_msgs, named_merge_points)
2652 else 2649 else
2653 err = 1; 2650 err = 1;
2654 } 2651 }
2652 else if (EQ (keyword, QCfoundry))
2653 {
2654 if (STRINGP (value))
2655 {
2656 to[LFACE_FOUNDRY_INDEX] = value;
2657 font_clear_prop (to, FONT_FOUNDRY_INDEX);
2658 }
2659 else
2660 err = 1;
2661 }
2655 else if (EQ (keyword, QCheight)) 2662 else if (EQ (keyword, QCheight))
2656 { 2663 {
2657 Lisp_Object new_height = 2664 Lisp_Object new_height =
@@ -3052,6 +3059,18 @@ FRAME 0 means change the face on all frames, and change the default
3052 LFACE_FAMILY (lface) = value; 3059 LFACE_FAMILY (lface) = value;
3053 prop_index = FONT_FAMILY_INDEX; 3060 prop_index = FONT_FAMILY_INDEX;
3054 } 3061 }
3062 else if (EQ (attr, QCfoundry))
3063 {
3064 if (!UNSPECIFIEDP (value) && !IGNORE_DEFFACE_P (value))
3065 {
3066 CHECK_STRING (value);
3067 if (SCHARS (value) == 0)
3068 signal_error ("Invalid face foundry", value);
3069 }
3070 old_value = LFACE_FOUNDRY (lface);
3071 LFACE_FOUNDRY (lface) = value;
3072 prop_index = FONT_FOUNDRY_INDEX;
3073 }
3055 else if (EQ (attr, QCheight)) 3074 else if (EQ (attr, QCheight))
3056 { 3075 {
3057 if (!UNSPECIFIEDP (value) && !IGNORE_DEFFACE_P (value)) 3076 if (!UNSPECIFIEDP (value) && !IGNORE_DEFFACE_P (value))
@@ -3730,6 +3749,7 @@ x_update_menu_appearance (f)
3730 3749
3731 if (face->font 3750 if (face->font
3732 && (!UNSPECIFIEDP (LFACE_FAMILY (lface)) 3751 && (!UNSPECIFIEDP (LFACE_FAMILY (lface))
3752 || !UNSPECIFIEDP (LFACE_FOUNDRY (lface))
3733 || !UNSPECIFIEDP (LFACE_SWIDTH (lface)) 3753 || !UNSPECIFIEDP (LFACE_SWIDTH (lface))
3734 || !UNSPECIFIEDP (LFACE_WEIGHT (lface)) 3754 || !UNSPECIFIEDP (LFACE_WEIGHT (lface))
3735 || !UNSPECIFIEDP (LFACE_SLANT (lface)) 3755 || !UNSPECIFIEDP (LFACE_SLANT (lface))
@@ -3846,6 +3866,8 @@ frames). If FRAME is omitted or nil, use the selected frame. */)
3846 3866
3847 if (EQ (keyword, QCfamily)) 3867 if (EQ (keyword, QCfamily))
3848 value = LFACE_FAMILY (lface); 3868 value = LFACE_FAMILY (lface);
3869 else if (EQ (keyword, QCfoundry))
3870 value = LFACE_FOUNDRY (lface);
3849 else if (EQ (keyword, QCheight)) 3871 else if (EQ (keyword, QCheight))
3850 value = LFACE_HEIGHT (lface); 3872 value = LFACE_HEIGHT (lface);
3851 else if (EQ (keyword, QCweight)) 3873 else if (EQ (keyword, QCweight))
@@ -4156,6 +4178,7 @@ lface_hash (v)
4156 Lisp_Object *v; 4178 Lisp_Object *v;
4157{ 4179{
4158 return (hash_string_case_insensitive (v[LFACE_FAMILY_INDEX]) 4180 return (hash_string_case_insensitive (v[LFACE_FAMILY_INDEX])
4181 ^ hash_string_case_insensitive (v[LFACE_FOUNDRY_INDEX])
4159 ^ hash_string_case_insensitive (v[LFACE_FOREGROUND_INDEX]) 4182 ^ hash_string_case_insensitive (v[LFACE_FOREGROUND_INDEX])
4160 ^ hash_string_case_insensitive (v[LFACE_BACKGROUND_INDEX]) 4183 ^ hash_string_case_insensitive (v[LFACE_BACKGROUND_INDEX])
4161 ^ XHASH (v[LFACE_WEIGHT_INDEX]) 4184 ^ XHASH (v[LFACE_WEIGHT_INDEX])
@@ -4178,6 +4201,8 @@ lface_same_font_attributes_p (lface1, lface2)
4178 && lface_fully_specified_p (lface2)); 4201 && lface_fully_specified_p (lface2));
4179 return (xstrcasecmp (SDATA (lface1[LFACE_FAMILY_INDEX]), 4202 return (xstrcasecmp (SDATA (lface1[LFACE_FAMILY_INDEX]),
4180 SDATA (lface2[LFACE_FAMILY_INDEX])) == 0 4203 SDATA (lface2[LFACE_FAMILY_INDEX])) == 0
4204 && xstrcasecmp (SDATA (lface1[LFACE_FOUNDRY_INDEX]),
4205 SDATA (lface2[LFACE_FOUNDRY_INDEX])) == 0
4181 && EQ (lface1[LFACE_HEIGHT_INDEX], lface2[LFACE_HEIGHT_INDEX]) 4206 && EQ (lface1[LFACE_HEIGHT_INDEX], lface2[LFACE_HEIGHT_INDEX])
4182 && EQ (lface1[LFACE_SWIDTH_INDEX], lface2[LFACE_SWIDTH_INDEX]) 4207 && EQ (lface1[LFACE_SWIDTH_INDEX], lface2[LFACE_SWIDTH_INDEX])
4183 && EQ (lface1[LFACE_WEIGHT_INDEX], lface2[LFACE_WEIGHT_INDEX]) 4208 && EQ (lface1[LFACE_WEIGHT_INDEX], lface2[LFACE_WEIGHT_INDEX])
@@ -5016,6 +5041,7 @@ x_supports_face_attributes_p (f, attrs, def_face)
5016 /* Check font-related attributes, as those are the most commonly 5041 /* Check font-related attributes, as those are the most commonly
5017 "unsupported" on a window-system (because of missing fonts). */ 5042 "unsupported" on a window-system (because of missing fonts). */
5018 if (!UNSPECIFIEDP (attrs[LFACE_FAMILY_INDEX]) 5043 if (!UNSPECIFIEDP (attrs[LFACE_FAMILY_INDEX])
5044 || !UNSPECIFIEDP (attrs[LFACE_FOUNDRY_INDEX])
5019 || !UNSPECIFIEDP (attrs[LFACE_HEIGHT_INDEX]) 5045 || !UNSPECIFIEDP (attrs[LFACE_HEIGHT_INDEX])
5020 || !UNSPECIFIEDP (attrs[LFACE_WEIGHT_INDEX]) 5046 || !UNSPECIFIEDP (attrs[LFACE_WEIGHT_INDEX])
5021 || !UNSPECIFIEDP (attrs[LFACE_SLANT_INDEX]) 5047 || !UNSPECIFIEDP (attrs[LFACE_SLANT_INDEX])
@@ -5103,6 +5129,7 @@ tty_supports_face_attributes_p (f, attrs, def_face)
5103 because the faked result is too different from what the face 5129 because the faked result is too different from what the face
5104 specifies. */ 5130 specifies. */
5105 if (!UNSPECIFIEDP (attrs[LFACE_FAMILY_INDEX]) 5131 if (!UNSPECIFIEDP (attrs[LFACE_FAMILY_INDEX])
5132 || !UNSPECIFIEDP (attrs[LFACE_FOUNDRY_INDEX])
5106 || !UNSPECIFIEDP (attrs[LFACE_STIPPLE_INDEX]) 5133 || !UNSPECIFIEDP (attrs[LFACE_STIPPLE_INDEX])
5107 || !UNSPECIFIEDP (attrs[LFACE_HEIGHT_INDEX]) 5134 || !UNSPECIFIEDP (attrs[LFACE_HEIGHT_INDEX])
5108 || !UNSPECIFIEDP (attrs[LFACE_SWIDTH_INDEX]) 5135 || !UNSPECIFIEDP (attrs[LFACE_SWIDTH_INDEX])
@@ -5402,7 +5429,13 @@ be found. Value is ALIST. */)
5402 (alist) 5429 (alist)
5403 Lisp_Object alist; 5430 Lisp_Object alist;
5404{ 5431{
5432 Lisp_Object tail, tail2;
5433
5405 CHECK_LIST (alist); 5434 CHECK_LIST (alist);
5435 alist = Fcopy_sequence (alist);
5436 for (tail = alist; CONSP (tail); tail = XCDR (tail))
5437 for (tail2 = XCAR (tail); CONSP (tail2); tail2 = XCDR (tail2))
5438 XSETCAR (tail2, Fintern (XCAR (tail2), Qnil));
5406 Vface_alternative_font_family_alist = alist; 5439 Vface_alternative_font_family_alist = alist;
5407 free_all_realized_faces (Qnil); 5440 free_all_realized_faces (Qnil);
5408 return alist; 5441 return alist;
@@ -5419,7 +5452,13 @@ be found. Value is ALIST. */)
5419 (alist) 5452 (alist)
5420 Lisp_Object alist; 5453 Lisp_Object alist;
5421{ 5454{
5455 Lisp_Object tail, tail2;
5456
5422 CHECK_LIST (alist); 5457 CHECK_LIST (alist);
5458 alist = Fcopy_sequence (alist);
5459 for (tail = alist; CONSP (tail); tail = XCDR (tail))
5460 for (tail2 = XCAR (tail); CONSP (tail2); tail2 = XCDR (tail2))
5461 XSETCAR (tail2, Fdowncase (XCAR (tail2)));
5423 Vface_alternative_font_registry_alist = alist; 5462 Vface_alternative_font_registry_alist = alist;
5424 free_all_realized_faces (Qnil); 5463 free_all_realized_faces (Qnil);
5425 return alist; 5464 return alist;
@@ -5542,6 +5581,7 @@ realize_default_face (f)
5542 if (!FRAME_WINDOW_P (f)) 5581 if (!FRAME_WINDOW_P (f))
5543 { 5582 {
5544 LFACE_FAMILY (lface) = build_string ("default"); 5583 LFACE_FAMILY (lface) = build_string ("default");
5584 LFACE_FOUNDRY (lface) = LFACE_FAMILY (lface);
5545 LFACE_SWIDTH (lface) = Qnormal; 5585 LFACE_SWIDTH (lface) = Qnormal;
5546 LFACE_HEIGHT (lface) = make_number (1); 5586 LFACE_HEIGHT (lface) = make_number (1);
5547 if (UNSPECIFIEDP (LFACE_WEIGHT (lface))) 5587 if (UNSPECIFIEDP (LFACE_WEIGHT (lface)))