aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Antipov2013-08-01 14:33:25 +0400
committerDmitry Antipov2013-08-01 14:33:25 +0400
commitfdb396e222923dc98d46c170381c6b33dc1e8d99 (patch)
tree9cf9c6074b8386eec0f9e7d0e610b98447894d4a
parent2f935d86fd7aa551e2c61d71c14a1c1a8b3ba707 (diff)
downloademacs-fdb396e222923dc98d46c170381c6b33dc1e8d99.tar.gz
emacs-fdb396e222923dc98d46c170381c6b33dc1e8d99.zip
Avoid redundant Lisp_Object <-> struct frame conversions in font API.
* font.h (struct font_driver): Change list, match, and list_family functions to accept struct frame * as first arg. * font.c (font_score, font_compare, font_sort_entities): Remove prototypes. (font_sort_entities, font_list_entities, font_select_entity): (font_find_for_lface, Flist_fonts, Ffont_family_list): Adjust to match font API change. * xfont.c (xfont_list, xfont_match, xfont_list_family): * ftfont.c (ftfont_list, ftfont_match, ftfont_list_family): * ftxfont.c (ftxfont_list, ftxfont_match): * xftfont.c (xftfont_list, xftfont_match): * nsfont.m (nsfont_list, nsfont_match, nsfont_list_family): * w32font.c (w32font_list, w32font_match, w32font_list): (w32font_list_internal, w32_font_match_internal): Likewise. * xfaces.c (Fx_family_fonts): Adjust user.
-rw-r--r--src/ChangeLog19
-rw-r--r--src/font.c45
-rw-r--r--src/font.h9
-rw-r--r--src/ftfont.c12
-rw-r--r--src/ftxfont.c8
-rw-r--r--src/nsfont.m16
-rw-r--r--src/w32font.c23
-rw-r--r--src/xfaces.c9
-rw-r--r--src/xfont.c15
-rw-r--r--src/xftfont.c8
10 files changed, 80 insertions, 84 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 8dc5fbbd01d..2e327e5e6dc 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,24 @@
12013-08-01 Dmitry Antipov <dmantipov@yandex.ru> 12013-08-01 Dmitry Antipov <dmantipov@yandex.ru>
2 2
3 Avoid redundant Lisp_Object <-> struct frame conversions in font API.
4 * font.h (struct font_driver): Change list, match, and list_family
5 functions to accept struct frame * as first arg.
6 * font.c (font_score, font_compare, font_sort_entities): Remove
7 prototypes.
8 (font_sort_entities, font_list_entities, font_select_entity):
9 (font_find_for_lface, Flist_fonts, Ffont_family_list): Adjust to
10 match font API change.
11 * xfont.c (xfont_list, xfont_match, xfont_list_family):
12 * ftfont.c (ftfont_list, ftfont_match, ftfont_list_family):
13 * ftxfont.c (ftxfont_list, ftxfont_match):
14 * xftfont.c (xftfont_list, xftfont_match):
15 * nsfont.m (nsfont_list, nsfont_match, nsfont_list_family):
16 * w32font.c (w32font_list, w32font_match, w32font_list):
17 (w32font_list_internal, w32_font_match_internal): Likewise.
18 * xfaces.c (Fx_family_fonts): Adjust user.
19
202013-08-01 Dmitry Antipov <dmantipov@yandex.ru>
21
3 Do not use pure Xism x_wm_set_icon_position in non-X ports. 22 Do not use pure Xism x_wm_set_icon_position in non-X ports.
4 * frame.c (x_set_frame_parameters): Call to x_wm_set_icon_position 23 * frame.c (x_set_frame_parameters): Call to x_wm_set_icon_position
5 only if HAVE_X_WINDOWS is in use. 24 only if HAVE_X_WINDOWS is in use.
diff --git a/src/font.c b/src/font.c
index 124d5f9bd9e..c9b9b5722a3 100644
--- a/src/font.c
+++ b/src/font.c
@@ -2037,11 +2037,6 @@ font_otf_Anchor (OTF_Anchor *anchor)
2037 2037
2038/* Font sorting. */ 2038/* Font sorting. */
2039 2039
2040static unsigned font_score (Lisp_Object, Lisp_Object *);
2041static int font_compare (const void *, const void *);
2042static Lisp_Object font_sort_entities (Lisp_Object, Lisp_Object,
2043 Lisp_Object, int);
2044
2045static double 2040static double
2046font_rescale_ratio (Lisp_Object font_entity) 2041font_rescale_ratio (Lisp_Object font_entity)
2047{ 2042{
@@ -2186,14 +2181,14 @@ font_compare (const void *d1, const void *d2)
2186 such a case. */ 2181 such a case. */
2187 2182
2188static Lisp_Object 2183static Lisp_Object
2189font_sort_entities (Lisp_Object list, Lisp_Object prefer, Lisp_Object frame, int best_only) 2184font_sort_entities (Lisp_Object list, Lisp_Object prefer,
2185 struct frame *f, int best_only)
2190{ 2186{
2191 Lisp_Object prefer_prop[FONT_SPEC_MAX]; 2187 Lisp_Object prefer_prop[FONT_SPEC_MAX];
2192 int len, maxlen, i; 2188 int len, maxlen, i;
2193 struct font_sort_data *data; 2189 struct font_sort_data *data;
2194 unsigned best_score; 2190 unsigned best_score;
2195 Lisp_Object best_entity; 2191 Lisp_Object best_entity;
2196 struct frame *f = XFRAME (frame);
2197 Lisp_Object tail, vec IF_LINT (= Qnil); 2192 Lisp_Object tail, vec IF_LINT (= Qnil);
2198 USE_SAFE_ALLOCA; 2193 USE_SAFE_ALLOCA;
2199 2194
@@ -2201,7 +2196,7 @@ font_sort_entities (Lisp_Object list, Lisp_Object prefer, Lisp_Object frame, int
2201 prefer_prop[i] = AREF (prefer, i); 2196 prefer_prop[i] = AREF (prefer, i);
2202 if (FLOATP (prefer_prop[FONT_SIZE_INDEX])) 2197 if (FLOATP (prefer_prop[FONT_SIZE_INDEX]))
2203 prefer_prop[FONT_SIZE_INDEX] 2198 prefer_prop[FONT_SIZE_INDEX]
2204 = make_number (font_pixel_size (XFRAME (frame), prefer)); 2199 = make_number (font_pixel_size (f, prefer));
2205 2200
2206 if (NILP (XCDR (list))) 2201 if (NILP (XCDR (list)))
2207 { 2202 {
@@ -2692,9 +2687,8 @@ font_delete_unmatched (Lisp_Object vec, Lisp_Object spec, int size)
2692 same font-driver. */ 2687 same font-driver. */
2693 2688
2694Lisp_Object 2689Lisp_Object
2695font_list_entities (Lisp_Object frame, Lisp_Object spec) 2690font_list_entities (struct frame *f, Lisp_Object spec)
2696{ 2691{
2697 FRAME_PTR f = XFRAME (frame);
2698 struct font_driver_list *driver_list = f->font_driver_list; 2692 struct font_driver_list *driver_list = f->font_driver_list;
2699 Lisp_Object ftype, val; 2693 Lisp_Object ftype, val;
2700 Lisp_Object list = Qnil; 2694 Lisp_Object list = Qnil;
@@ -2738,7 +2732,7 @@ font_list_entities (Lisp_Object frame, Lisp_Object spec)
2738 { 2732 {
2739 Lisp_Object copy; 2733 Lisp_Object copy;
2740 2734
2741 val = driver_list->driver->list (frame, scratch_font_spec); 2735 val = driver_list->driver->list (f, scratch_font_spec);
2742 if (NILP (val)) 2736 if (NILP (val))
2743 val = zero_vector; 2737 val = zero_vector;
2744 else 2738 else
@@ -2770,10 +2764,8 @@ font_matching_entity (FRAME_PTR f, Lisp_Object *attrs, Lisp_Object spec)
2770{ 2764{
2771 struct font_driver_list *driver_list = f->font_driver_list; 2765 struct font_driver_list *driver_list = f->font_driver_list;
2772 Lisp_Object ftype, size, entity; 2766 Lisp_Object ftype, size, entity;
2773 Lisp_Object frame;
2774 Lisp_Object work = copy_font_spec (spec); 2767 Lisp_Object work = copy_font_spec (spec);
2775 2768
2776 XSETFRAME (frame, f);
2777 ftype = AREF (spec, FONT_TYPE_INDEX); 2769 ftype = AREF (spec, FONT_TYPE_INDEX);
2778 size = AREF (spec, FONT_SIZE_INDEX); 2770 size = AREF (spec, FONT_SIZE_INDEX);
2779 2771
@@ -2797,7 +2789,7 @@ font_matching_entity (FRAME_PTR f, Lisp_Object *attrs, Lisp_Object spec)
2797 entity = XCDR (entity); 2789 entity = XCDR (entity);
2798 else 2790 else
2799 { 2791 {
2800 entity = driver_list->driver->match (frame, work); 2792 entity = driver_list->driver->match (f, work);
2801 copy = copy_font_spec (work); 2793 copy = copy_font_spec (work);
2802 ASET (copy, FONT_TYPE_INDEX, driver_list->driver->type); 2794 ASET (copy, FONT_TYPE_INDEX, driver_list->driver->type);
2803 XSETCDR (cache, Fcons (Fcons (copy, entity), XCDR (cache))); 2795 XSETCDR (cache, Fcons (Fcons (copy, entity), XCDR (cache)));
@@ -3039,12 +3031,12 @@ font_clear_prop (Lisp_Object *attrs, enum font_property_index prop)
3039 supports C and is the best match for ATTRS and PIXEL_SIZE. */ 3031 supports C and is the best match for ATTRS and PIXEL_SIZE. */
3040 3032
3041static Lisp_Object 3033static Lisp_Object
3042font_select_entity (Lisp_Object frame, Lisp_Object entities, Lisp_Object *attrs, int pixel_size, int c) 3034font_select_entity (struct frame *f, Lisp_Object entities,
3035 Lisp_Object *attrs, int pixel_size, int c)
3043{ 3036{
3044 Lisp_Object font_entity; 3037 Lisp_Object font_entity;
3045 Lisp_Object prefer; 3038 Lisp_Object prefer;
3046 int i; 3039 int i;
3047 FRAME_PTR f = XFRAME (frame);
3048 3040
3049 if (NILP (XCDR (entities)) 3041 if (NILP (XCDR (entities))
3050 && ASIZE (XCAR (entities)) == 1) 3042 && ASIZE (XCAR (entities)) == 1)
@@ -3075,7 +3067,7 @@ font_select_entity (Lisp_Object frame, Lisp_Object entities, Lisp_Object *attrs,
3075 FONT_SET_STYLE (prefer, FONT_WIDTH_INDEX, attrs[LFACE_SWIDTH_INDEX]); 3067 FONT_SET_STYLE (prefer, FONT_WIDTH_INDEX, attrs[LFACE_SWIDTH_INDEX]);
3076 ASET (prefer, FONT_SIZE_INDEX, make_number (pixel_size)); 3068 ASET (prefer, FONT_SIZE_INDEX, make_number (pixel_size));
3077 3069
3078 return font_sort_entities (entities, prefer, frame, c); 3070 return font_sort_entities (entities, prefer, f, c);
3079} 3071}
3080 3072
3081/* Return a font-entity that satisfies SPEC and is the best match for 3073/* Return a font-entity that satisfies SPEC and is the best match for
@@ -3086,7 +3078,7 @@ Lisp_Object
3086font_find_for_lface (FRAME_PTR f, Lisp_Object *attrs, Lisp_Object spec, int c) 3078font_find_for_lface (FRAME_PTR f, Lisp_Object *attrs, Lisp_Object spec, int c)
3087{ 3079{
3088 Lisp_Object work; 3080 Lisp_Object work;
3089 Lisp_Object frame, entities, val; 3081 Lisp_Object entities, val;
3090 Lisp_Object foundry[3], *family, registry[3], adstyle[3]; 3082 Lisp_Object foundry[3], *family, registry[3], adstyle[3];
3091 int pixel_size; 3083 int pixel_size;
3092 int i, j, k, l; 3084 int i, j, k, l;
@@ -3118,7 +3110,6 @@ font_find_for_lface (FRAME_PTR f, Lisp_Object *attrs, Lisp_Object spec, int c)
3118 3110
3119 work = copy_font_spec (spec); 3111 work = copy_font_spec (spec);
3120 ASET (work, FONT_TYPE_INDEX, AREF (spec, FONT_TYPE_INDEX)); 3112 ASET (work, FONT_TYPE_INDEX, AREF (spec, FONT_TYPE_INDEX));
3121 XSETFRAME (frame, f);
3122 pixel_size = font_pixel_size (f, spec); 3113 pixel_size = font_pixel_size (f, spec);
3123 if (pixel_size == 0 && INTEGERP (attrs[LFACE_HEIGHT_INDEX])) 3114 if (pixel_size == 0 && INTEGERP (attrs[LFACE_HEIGHT_INDEX]))
3124 { 3115 {
@@ -3212,10 +3203,10 @@ font_find_for_lface (FRAME_PTR f, Lisp_Object *attrs, Lisp_Object spec, int c)
3212 for (l = 0; SYMBOLP (adstyle[l]); l++) 3203 for (l = 0; SYMBOLP (adstyle[l]); l++)
3213 { 3204 {
3214 ASET (work, FONT_ADSTYLE_INDEX, adstyle[l]); 3205 ASET (work, FONT_ADSTYLE_INDEX, adstyle[l]);
3215 entities = font_list_entities (frame, work); 3206 entities = font_list_entities (f, work);
3216 if (! NILP (entities)) 3207 if (! NILP (entities))
3217 { 3208 {
3218 val = font_select_entity (frame, entities, 3209 val = font_select_entity (f, entities,
3219 attrs, pixel_size, c); 3210 attrs, pixel_size, c);
3220 if (! NILP (val)) 3211 if (! NILP (val))
3221 return val; 3212 return val;
@@ -4110,12 +4101,10 @@ control the order of the returned list. Fonts are sorted by
4110how close they are to PREFER. */) 4101how close they are to PREFER. */)
4111 (Lisp_Object font_spec, Lisp_Object frame, Lisp_Object num, Lisp_Object prefer) 4102 (Lisp_Object font_spec, Lisp_Object frame, Lisp_Object num, Lisp_Object prefer)
4112{ 4103{
4104 struct frame *f = decode_live_frame (frame);
4113 Lisp_Object vec, list; 4105 Lisp_Object vec, list;
4114 EMACS_INT n = 0; 4106 EMACS_INT n = 0;
4115 4107
4116 if (NILP (frame))
4117 frame = selected_frame;
4118 CHECK_LIVE_FRAME (frame);
4119 CHECK_FONT_SPEC (font_spec); 4108 CHECK_FONT_SPEC (font_spec);
4120 if (! NILP (num)) 4109 if (! NILP (num))
4121 { 4110 {
@@ -4127,7 +4116,7 @@ how close they are to PREFER. */)
4127 if (! NILP (prefer)) 4116 if (! NILP (prefer))
4128 CHECK_FONT_SPEC (prefer); 4117 CHECK_FONT_SPEC (prefer);
4129 4118
4130 list = font_list_entities (frame, font_spec); 4119 list = font_list_entities (f, font_spec);
4131 if (NILP (list)) 4120 if (NILP (list))
4132 return Qnil; 4121 return Qnil;
4133 if (NILP (XCDR (list)) 4122 if (NILP (XCDR (list))
@@ -4135,7 +4124,7 @@ how close they are to PREFER. */)
4135 return list1 (AREF (XCAR (list), 0)); 4124 return list1 (AREF (XCAR (list), 0));
4136 4125
4137 if (! NILP (prefer)) 4126 if (! NILP (prefer))
4138 vec = font_sort_entities (list, prefer, frame, 0); 4127 vec = font_sort_entities (list, prefer, f, 0);
4139 else 4128 else
4140 vec = font_vconcat_entity_vectors (list); 4129 vec = font_vconcat_entity_vectors (list);
4141 if (n == 0 || n >= ASIZE (vec)) 4130 if (n == 0 || n >= ASIZE (vec))
@@ -4163,13 +4152,11 @@ If FRAME is omitted or nil, the selected frame is used. */)
4163 struct font_driver_list *driver_list; 4152 struct font_driver_list *driver_list;
4164 Lisp_Object list = Qnil; 4153 Lisp_Object list = Qnil;
4165 4154
4166 XSETFRAME (frame, f);
4167
4168 for (driver_list = f->font_driver_list; driver_list; 4155 for (driver_list = f->font_driver_list; driver_list;
4169 driver_list = driver_list->next) 4156 driver_list = driver_list->next)
4170 if (driver_list->driver->list_family) 4157 if (driver_list->driver->list_family)
4171 { 4158 {
4172 Lisp_Object val = driver_list->driver->list_family (frame); 4159 Lisp_Object val = driver_list->driver->list_family (f);
4173 Lisp_Object tail = list; 4160 Lisp_Object tail = list;
4174 4161
4175 for (; CONSP (val); val = XCDR (val)) 4162 for (; CONSP (val); val = XCDR (val))
diff --git a/src/font.h b/src/font.h
index ffed0461ff7..dfb58686182 100644
--- a/src/font.h
+++ b/src/font.h
@@ -527,7 +527,7 @@ struct font_driver
527 527
528 This and the following `match' are the only APIs that allocate 528 This and the following `match' are the only APIs that allocate
529 font-entities. */ 529 font-entities. */
530 Lisp_Object (*list) (Lisp_Object frame, Lisp_Object font_spec); 530 Lisp_Object (*list) (struct frame *frame, Lisp_Object font_spec);
531 531
532 /* Return a font-entity most closely matching with FONT_SPEC on 532 /* Return a font-entity most closely matching with FONT_SPEC on
533 FRAME. Which font property to consider, and how to calculate the 533 FRAME. Which font property to consider, and how to calculate the
@@ -536,12 +536,12 @@ struct font_driver
536 536
537 The properties that the font-entity has is the same as `list' 537 The properties that the font-entity has is the same as `list'
538 method. */ 538 method. */
539 Lisp_Object (*match) (Lisp_Object frame, Lisp_Object font_spec); 539 Lisp_Object (*match) (struct frame *f, Lisp_Object spec);
540 540
541 /* Optional. 541 /* Optional.
542 List available families. The value is a list of family names 542 List available families. The value is a list of family names
543 (symbols). */ 543 (symbols). */
544 Lisp_Object (*list_family) (Lisp_Object frame); 544 Lisp_Object (*list_family) (struct frame *f);
545 545
546 /* Optional (if FONT_EXTRA_INDEX is not Lisp_Save_Value). 546 /* Optional (if FONT_EXTRA_INDEX is not Lisp_Save_Value).
547 Free FONT_EXTRA_INDEX field of FONT_ENTITY. */ 547 Free FONT_EXTRA_INDEX field of FONT_ENTITY. */
@@ -742,8 +742,7 @@ extern Lisp_Object font_style_symbolic (Lisp_Object font,
742 bool for_face); 742 bool for_face);
743 743
744extern bool font_match_p (Lisp_Object spec, Lisp_Object font); 744extern bool font_match_p (Lisp_Object spec, Lisp_Object font);
745extern Lisp_Object font_list_entities (Lisp_Object frame, 745extern Lisp_Object font_list_entities (struct frame *, Lisp_Object);
746 Lisp_Object spec);
747 746
748extern Lisp_Object font_get_name (Lisp_Object font_object); 747extern Lisp_Object font_get_name (Lisp_Object font_object);
749extern Lisp_Object font_spec_from_name (Lisp_Object font_name); 748extern Lisp_Object font_spec_from_name (Lisp_Object font_name);
diff --git a/src/ftfont.c b/src/ftfont.c
index 10090cb3bda..14896e3f668 100644
--- a/src/ftfont.c
+++ b/src/ftfont.c
@@ -494,9 +494,9 @@ ftfont_get_otf (struct ftfont_info *ftfont_info)
494#endif /* HAVE_LIBOTF */ 494#endif /* HAVE_LIBOTF */
495 495
496static Lisp_Object ftfont_get_cache (FRAME_PTR); 496static Lisp_Object ftfont_get_cache (FRAME_PTR);
497static Lisp_Object ftfont_list (Lisp_Object, Lisp_Object); 497static Lisp_Object ftfont_list (struct frame *, Lisp_Object);
498static Lisp_Object ftfont_match (Lisp_Object, Lisp_Object); 498static Lisp_Object ftfont_match (struct frame *, Lisp_Object);
499static Lisp_Object ftfont_list_family (Lisp_Object); 499static Lisp_Object ftfont_list_family (struct frame *);
500static Lisp_Object ftfont_open (FRAME_PTR, Lisp_Object, int); 500static Lisp_Object ftfont_open (FRAME_PTR, Lisp_Object, int);
501static void ftfont_close (FRAME_PTR, struct font *); 501static void ftfont_close (FRAME_PTR, struct font *);
502static int ftfont_has_char (Lisp_Object, int); 502static int ftfont_has_char (Lisp_Object, int);
@@ -884,7 +884,7 @@ ftfont_spec_pattern (Lisp_Object spec, char *otlayout, struct OpenTypeSpec **ots
884} 884}
885 885
886static Lisp_Object 886static Lisp_Object
887ftfont_list (Lisp_Object frame, Lisp_Object spec) 887ftfont_list (struct frame *f, Lisp_Object spec)
888{ 888{
889 Lisp_Object val = Qnil, family, adstyle; 889 Lisp_Object val = Qnil, family, adstyle;
890 int i; 890 int i;
@@ -1080,7 +1080,7 @@ ftfont_list (Lisp_Object frame, Lisp_Object spec)
1080} 1080}
1081 1081
1082static Lisp_Object 1082static Lisp_Object
1083ftfont_match (Lisp_Object frame, Lisp_Object spec) 1083ftfont_match (struct frame *f, Lisp_Object spec)
1084{ 1084{
1085 Lisp_Object entity = Qnil; 1085 Lisp_Object entity = Qnil;
1086 FcPattern *pattern, *match = NULL; 1086 FcPattern *pattern, *match = NULL;
@@ -1130,7 +1130,7 @@ ftfont_match (Lisp_Object frame, Lisp_Object spec)
1130} 1130}
1131 1131
1132static Lisp_Object 1132static Lisp_Object
1133ftfont_list_family (Lisp_Object frame) 1133ftfont_list_family (struct frame *f)
1134{ 1134{
1135 Lisp_Object list = Qnil; 1135 Lisp_Object list = Qnil;
1136 FcPattern *pattern = NULL; 1136 FcPattern *pattern = NULL;
diff --git a/src/ftxfont.c b/src/ftxfont.c
index 8c56ee05adc..9f9433e7183 100644
--- a/src/ftxfont.c
+++ b/src/ftxfont.c
@@ -226,9 +226,9 @@ ftxfont_draw_background (FRAME_PTR f, struct font *font, GC gc, int x, int y,
226} 226}
227 227
228static Lisp_Object 228static Lisp_Object
229ftxfont_list (Lisp_Object frame, Lisp_Object spec) 229ftxfont_list (struct frame *f, Lisp_Object spec)
230{ 230{
231 Lisp_Object list = ftfont_driver.list (frame, spec), tail; 231 Lisp_Object list = ftfont_driver.list (f, spec), tail;
232 232
233 for (tail = list; CONSP (tail); tail = XCDR (tail)) 233 for (tail = list; CONSP (tail); tail = XCDR (tail))
234 ASET (XCAR (tail), FONT_TYPE_INDEX, Qftx); 234 ASET (XCAR (tail), FONT_TYPE_INDEX, Qftx);
@@ -236,9 +236,9 @@ ftxfont_list (Lisp_Object frame, Lisp_Object spec)
236} 236}
237 237
238static Lisp_Object 238static Lisp_Object
239ftxfont_match (Lisp_Object frame, Lisp_Object spec) 239ftxfont_match (struct frame *f, Lisp_Object spec)
240{ 240{
241 Lisp_Object entity = ftfont_driver.match (frame, spec); 241 Lisp_Object entity = ftfont_driver.match (f, spec);
242 242
243 if (VECTORP (entity)) 243 if (VECTORP (entity))
244 ASET (entity, FONT_TYPE_INDEX, Qftx); 244 ASET (entity, FONT_TYPE_INDEX, Qftx);
diff --git a/src/nsfont.m b/src/nsfont.m
index df7ef0bb0bc..26a80624f7c 100644
--- a/src/nsfont.m
+++ b/src/nsfont.m
@@ -620,9 +620,9 @@ ns_findfonts (Lisp_Object font_spec, BOOL isMatch)
620 620
621 621
622static Lisp_Object nsfont_get_cache (FRAME_PTR frame); 622static Lisp_Object nsfont_get_cache (FRAME_PTR frame);
623static Lisp_Object nsfont_list (Lisp_Object frame, Lisp_Object font_spec); 623static Lisp_Object nsfont_list (struct frame *, Lisp_Object);
624static Lisp_Object nsfont_match (Lisp_Object frame, Lisp_Object font_spec); 624static Lisp_Object nsfont_match (struct frame *, Lisp_Object);
625static Lisp_Object nsfont_list_family (Lisp_Object frame); 625static Lisp_Object nsfont_list_family (struct frame *);
626static Lisp_Object nsfont_open (FRAME_PTR f, Lisp_Object font_entity, 626static Lisp_Object nsfont_open (FRAME_PTR f, Lisp_Object font_entity,
627 int pixel_size); 627 int pixel_size);
628static void nsfont_close (FRAME_PTR f, struct font *font); 628static void nsfont_close (FRAME_PTR f, struct font *font);
@@ -679,9 +679,9 @@ nsfont_get_cache (FRAME_PTR frame)
679 weight, slant, width, size (0 if scalable), 679 weight, slant, width, size (0 if scalable),
680 dpi, spacing, avgwidth (0 if scalable) */ 680 dpi, spacing, avgwidth (0 if scalable) */
681static Lisp_Object 681static Lisp_Object
682nsfont_list (Lisp_Object frame, Lisp_Object font_spec) 682nsfont_list (struct frame *f, Lisp_Object font_spec)
683{ 683{
684 return ns_findfonts (font_spec, NO); 684 return ns_findfonts (font_spec, NO);
685} 685}
686 686
687 687
@@ -690,16 +690,16 @@ nsfont_list (Lisp_Object frame, Lisp_Object font_spec)
690 `face-font-selection-order' is ignored here. 690 `face-font-selection-order' is ignored here.
691 Properties to be considered are same as for list(). */ 691 Properties to be considered are same as for list(). */
692static Lisp_Object 692static Lisp_Object
693nsfont_match (Lisp_Object frame, Lisp_Object font_spec) 693nsfont_match (struct frame *f, Lisp_Object font_spec)
694{ 694{
695 return ns_findfonts(font_spec, YES); 695 return ns_findfonts (font_spec, YES);
696} 696}
697 697
698 698
699/* List available families. The value is a list of family names 699/* List available families. The value is a list of family names
700 (symbols). */ 700 (symbols). */
701static Lisp_Object 701static Lisp_Object
702nsfont_list_family (Lisp_Object frame) 702nsfont_list_family (struct frame *f)
703{ 703{
704 Lisp_Object list = Qnil; 704 Lisp_Object list = Qnil;
705 NSEnumerator *families; 705 NSEnumerator *families;
diff --git a/src/w32font.c b/src/w32font.c
index 105daa06365..eb5163b7414 100644
--- a/src/w32font.c
+++ b/src/w32font.c
@@ -309,9 +309,9 @@ w32font_get_cache (FRAME_PTR f)
309 is a vector of font-entities. This is the sole API that 309 is a vector of font-entities. This is the sole API that
310 allocates font-entities. */ 310 allocates font-entities. */
311static Lisp_Object 311static Lisp_Object
312w32font_list (Lisp_Object frame, Lisp_Object font_spec) 312w32font_list (struct frame *f, Lisp_Object font_spec)
313{ 313{
314 Lisp_Object fonts = w32font_list_internal (frame, font_spec, 0); 314 Lisp_Object fonts = w32font_list_internal (f, font_spec, 0);
315 FONT_ADD_LOG ("w32font-list", font_spec, fonts); 315 FONT_ADD_LOG ("w32font-list", font_spec, fonts);
316 return fonts; 316 return fonts;
317} 317}
@@ -321,9 +321,9 @@ w32font_list (Lisp_Object frame, Lisp_Object font_spec)
321 FRAME. The closeness is determined by the font backend, thus 321 FRAME. The closeness is determined by the font backend, thus
322 `face-font-selection-order' is ignored here. */ 322 `face-font-selection-order' is ignored here. */
323static Lisp_Object 323static Lisp_Object
324w32font_match (Lisp_Object frame, Lisp_Object font_spec) 324w32font_match (struct frame *f, Lisp_Object font_spec)
325{ 325{
326 Lisp_Object entity = w32font_match_internal (frame, font_spec, 0); 326 Lisp_Object entity = w32font_match_internal (f, font_spec, 0);
327 FONT_ADD_LOG ("w32font-match", font_spec, entity); 327 FONT_ADD_LOG ("w32font-match", font_spec, entity);
328 return entity; 328 return entity;
329} 329}
@@ -332,12 +332,11 @@ w32font_match (Lisp_Object frame, Lisp_Object font_spec)
332 List available families. The value is a list of family names 332 List available families. The value is a list of family names
333 (symbols). */ 333 (symbols). */
334static Lisp_Object 334static Lisp_Object
335w32font_list_family (Lisp_Object frame) 335w32font_list_family (struct frame *f)
336{ 336{
337 Lisp_Object list = Qnil; 337 Lisp_Object list = Qnil;
338 LOGFONT font_match_pattern; 338 LOGFONT font_match_pattern;
339 HDC dc; 339 HDC dc;
340 FRAME_PTR f = XFRAME (frame);
341 340
342 memset (&font_match_pattern, 0, sizeof (font_match_pattern)); 341 memset (&font_match_pattern, 0, sizeof (font_match_pattern));
343 font_match_pattern.lfCharSet = DEFAULT_CHARSET; 342 font_match_pattern.lfCharSet = DEFAULT_CHARSET;
@@ -811,15 +810,14 @@ w32font_otf_drive (struct font *font, Lisp_Object features,
811 Additional parameter opentype_only restricts the returned fonts to 810 Additional parameter opentype_only restricts the returned fonts to
812 opentype fonts, which can be used with the Uniscribe backend. */ 811 opentype fonts, which can be used with the Uniscribe backend. */
813Lisp_Object 812Lisp_Object
814w32font_list_internal (Lisp_Object frame, Lisp_Object font_spec, int opentype_only) 813w32font_list_internal (struct frame *f, Lisp_Object font_spec, int opentype_only)
815{ 814{
816 struct font_callback_data match_data; 815 struct font_callback_data match_data;
817 HDC dc; 816 HDC dc;
818 FRAME_PTR f = XFRAME (frame);
819 817
820 match_data.orig_font_spec = font_spec; 818 match_data.orig_font_spec = font_spec;
821 match_data.list = Qnil; 819 match_data.list = Qnil;
822 match_data.frame = frame; 820 XSETFRAME (match_data.frame, f);
823 821
824 memset (&match_data.pattern, 0, sizeof (LOGFONT)); 822 memset (&match_data.pattern, 0, sizeof (LOGFONT));
825 fill_in_logfont (f, &match_data.pattern, font_spec); 823 fill_in_logfont (f, &match_data.pattern, font_spec);
@@ -864,14 +862,13 @@ w32font_list_internal (Lisp_Object frame, Lisp_Object font_spec, int opentype_on
864 Additional parameter opentype_only restricts the returned fonts to 862 Additional parameter opentype_only restricts the returned fonts to
865 opentype fonts, which can be used with the Uniscribe backend. */ 863 opentype fonts, which can be used with the Uniscribe backend. */
866Lisp_Object 864Lisp_Object
867w32font_match_internal (Lisp_Object frame, Lisp_Object font_spec, int opentype_only) 865w32font_match_internal (struct frame *f, Lisp_Object font_spec, int opentype_only)
868{ 866{
869 struct font_callback_data match_data; 867 struct font_callback_data match_data;
870 HDC dc; 868 HDC dc;
871 FRAME_PTR f = XFRAME (frame);
872 869
873 match_data.orig_font_spec = font_spec; 870 match_data.orig_font_spec = font_spec;
874 match_data.frame = frame; 871 XSETFRAME (match_data.frame, f);
875 match_data.list = Qnil; 872 match_data.list = Qnil;
876 873
877 memset (&match_data.pattern, 0, sizeof (LOGFONT)); 874 memset (&match_data.pattern, 0, sizeof (LOGFONT));
@@ -2114,7 +2111,7 @@ static void
2114list_all_matching_fonts (struct font_callback_data *match_data) 2111list_all_matching_fonts (struct font_callback_data *match_data)
2115{ 2112{
2116 HDC dc; 2113 HDC dc;
2117 Lisp_Object families = w32font_list_family (match_data->frame); 2114 Lisp_Object families = w32font_list_family (XFRAME (match_data->frame));
2118 struct frame *f = XFRAME (match_data->frame); 2115 struct frame *f = XFRAME (match_data->frame);
2119 2116
2120 dc = get_frame_dc (f); 2117 dc = get_frame_dc (f);
diff --git a/src/xfaces.c b/src/xfaces.c
index 52cd65c029f..b187193fc70 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -1530,15 +1530,12 @@ the face font sort order. */)
1530 (Lisp_Object family, Lisp_Object frame) 1530 (Lisp_Object family, Lisp_Object frame)
1531{ 1531{
1532 Lisp_Object font_spec, list, *drivers, vec; 1532 Lisp_Object font_spec, list, *drivers, vec;
1533 struct frame *f = decode_live_frame (frame);
1533 ptrdiff_t i, nfonts; 1534 ptrdiff_t i, nfonts;
1534 EMACS_INT ndrivers; 1535 EMACS_INT ndrivers;
1535 Lisp_Object result; 1536 Lisp_Object result;
1536 USE_SAFE_ALLOCA; 1537 USE_SAFE_ALLOCA;
1537 1538
1538 if (NILP (frame))
1539 frame = selected_frame;
1540 CHECK_LIVE_FRAME (frame);
1541
1542 font_spec = Ffont_spec (0, NULL); 1539 font_spec = Ffont_spec (0, NULL);
1543 if (!NILP (family)) 1540 if (!NILP (family))
1544 { 1541 {
@@ -1546,7 +1543,7 @@ the face font sort order. */)
1546 font_parse_family_registry (family, Qnil, font_spec); 1543 font_parse_family_registry (family, Qnil, font_spec);
1547 } 1544 }
1548 1545
1549 list = font_list_entities (frame, font_spec); 1546 list = font_list_entities (f, font_spec);
1550 if (NILP (list)) 1547 if (NILP (list))
1551 return Qnil; 1548 return Qnil;
1552 1549
@@ -1589,7 +1586,7 @@ the face font sort order. */)
1589 ASET (v, 0, AREF (font, FONT_FAMILY_INDEX)); 1586 ASET (v, 0, AREF (font, FONT_FAMILY_INDEX));
1590 ASET (v, 1, FONT_WIDTH_SYMBOLIC (font)); 1587 ASET (v, 1, FONT_WIDTH_SYMBOLIC (font));
1591 point = PIXEL_TO_POINT (XINT (AREF (font, FONT_SIZE_INDEX)) * 10, 1588 point = PIXEL_TO_POINT (XINT (AREF (font, FONT_SIZE_INDEX)) * 10,
1592 FRAME_RES_Y (XFRAME (frame))); 1589 FRAME_RES_Y (f));
1593 ASET (v, 2, make_number (point)); 1590 ASET (v, 2, make_number (point));
1594 ASET (v, 3, FONT_WEIGHT_SYMBOLIC (font)); 1591 ASET (v, 3, FONT_WEIGHT_SYMBOLIC (font));
1595 ASET (v, 4, FONT_SLANT_SYMBOLIC (font)); 1592 ASET (v, 4, FONT_SLANT_SYMBOLIC (font));
diff --git a/src/xfont.c b/src/xfont.c
index 9647a51ac6e..1a0e0f70f68 100644
--- a/src/xfont.c
+++ b/src/xfont.c
@@ -115,9 +115,9 @@ xfont_get_pcm (XFontStruct *xfont, XChar2b *char2b)
115} 115}
116 116
117static Lisp_Object xfont_get_cache (FRAME_PTR); 117static Lisp_Object xfont_get_cache (FRAME_PTR);
118static Lisp_Object xfont_list (Lisp_Object, Lisp_Object); 118static Lisp_Object xfont_list (struct frame *, Lisp_Object);
119static Lisp_Object xfont_match (Lisp_Object, Lisp_Object); 119static Lisp_Object xfont_match (struct frame *, Lisp_Object);
120static Lisp_Object xfont_list_family (Lisp_Object); 120static Lisp_Object xfont_list_family (struct frame *);
121static Lisp_Object xfont_open (FRAME_PTR, Lisp_Object, int); 121static Lisp_Object xfont_open (FRAME_PTR, Lisp_Object, int);
122static void xfont_close (FRAME_PTR, struct font *); 122static void xfont_close (FRAME_PTR, struct font *);
123static int xfont_prepare_face (FRAME_PTR, struct face *); 123static int xfont_prepare_face (FRAME_PTR, struct face *);
@@ -486,9 +486,8 @@ xfont_list_pattern (Display *display, const char *pattern,
486} 486}
487 487
488static Lisp_Object 488static Lisp_Object
489xfont_list (Lisp_Object frame, Lisp_Object spec) 489xfont_list (struct frame *f, Lisp_Object spec)
490{ 490{
491 FRAME_PTR f = XFRAME (frame);
492 Display *display = FRAME_X_DISPLAY_INFO (f)->display; 491 Display *display = FRAME_X_DISPLAY_INFO (f)->display;
493 Lisp_Object registry, list, val, extra, script; 492 Lisp_Object registry, list, val, extra, script;
494 int len; 493 int len;
@@ -565,9 +564,8 @@ xfont_list (Lisp_Object frame, Lisp_Object spec)
565} 564}
566 565
567static Lisp_Object 566static Lisp_Object
568xfont_match (Lisp_Object frame, Lisp_Object spec) 567xfont_match (struct frame *f, Lisp_Object spec)
569{ 568{
570 FRAME_PTR f = XFRAME (frame);
571 Display *display = FRAME_X_DISPLAY_INFO (f)->display; 569 Display *display = FRAME_X_DISPLAY_INFO (f)->display;
572 Lisp_Object extra, val, entity; 570 Lisp_Object extra, val, entity;
573 char name[512]; 571 char name[512];
@@ -622,9 +620,8 @@ xfont_match (Lisp_Object frame, Lisp_Object spec)
622} 620}
623 621
624static Lisp_Object 622static Lisp_Object
625xfont_list_family (Lisp_Object frame) 623xfont_list_family (struct frame *f)
626{ 624{
627 FRAME_PTR f = XFRAME (frame);
628 Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f); 625 Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
629 char **names; 626 char **names;
630 int num_fonts, i; 627 int num_fonts, i;
diff --git a/src/xftfont.c b/src/xftfont.c
index 166a70acd85..5757a4d20f7 100644
--- a/src/xftfont.c
+++ b/src/xftfont.c
@@ -139,9 +139,9 @@ xftfont_get_colors (FRAME_PTR f, struct face *face, GC gc, struct xftface_info *
139struct font_driver xftfont_driver; 139struct font_driver xftfont_driver;
140 140
141static Lisp_Object 141static Lisp_Object
142xftfont_list (Lisp_Object frame, Lisp_Object spec) 142xftfont_list (struct frame *f, Lisp_Object spec)
143{ 143{
144 Lisp_Object list = ftfont_driver.list (frame, spec), tail; 144 Lisp_Object list = ftfont_driver.list (f, spec), tail;
145 145
146 for (tail = list; CONSP (tail); tail = XCDR (tail)) 146 for (tail = list; CONSP (tail); tail = XCDR (tail))
147 ASET (XCAR (tail), FONT_TYPE_INDEX, Qxft); 147 ASET (XCAR (tail), FONT_TYPE_INDEX, Qxft);
@@ -149,9 +149,9 @@ xftfont_list (Lisp_Object frame, Lisp_Object spec)
149} 149}
150 150
151static Lisp_Object 151static Lisp_Object
152xftfont_match (Lisp_Object frame, Lisp_Object spec) 152xftfont_match (struct frame *f, Lisp_Object spec)
153{ 153{
154 Lisp_Object entity = ftfont_driver.match (frame, spec); 154 Lisp_Object entity = ftfont_driver.match (f, spec);
155 155
156 if (! NILP (entity)) 156 if (! NILP (entity))
157 ASET (entity, FONT_TYPE_INDEX, Qxft); 157 ASET (entity, FONT_TYPE_INDEX, Qxft);