Commit 92470028 authored by Paul Eggert's avatar Paul Eggert
Browse files

font.c: Make copy_font_spec and merge_font_spec ordinary C functions.

* font.c (copy_font_spec): Rename from Fcopy_font_spec, since it
was inaccessible from Lisp.
(merge_font_spec): Likewise, renaming from Fmerge_font_spec.
* font.c, font.h, fontset.c, xfaces.c, xfont.c: Change all uses.
parent 244ed907
2011-04-11 Paul Eggert <eggert@cs.ucla.edu> 2011-04-11 Paul Eggert <eggert@cs.ucla.edu>
font.c: Make copy_font_spec and merge_font_spec ordinary C functions.
* font.c (copy_font_spec): Rename from Fcopy_font_spec, since it
was inaccessible from Lisp.
(merge_font_spec): Likewise, renaming from Fmerge_font_spec.
* font.c, font.h, fontset.c, xfaces.c, xfont.c: Change all uses.
alloc.c: Import and export fewer symbols, and remove unused items. alloc.c: Import and export fewer symbols, and remove unused items.
* lisp.h (suppress_checking, die): Declare only if ENABLE_CHECKING * lisp.h (suppress_checking, die): Declare only if ENABLE_CHECKING
is defined. is defined.
......
...@@ -2727,7 +2727,7 @@ font_list_entities (Lisp_Object frame, Lisp_Object spec) ...@@ -2727,7 +2727,7 @@ font_list_entities (Lisp_Object frame, Lisp_Object spec)
val = null_vector; val = null_vector;
else else
val = Fvconcat (1, &val); val = Fvconcat (1, &val);
copy = Fcopy_font_spec (scratch_font_spec); copy = copy_font_spec (scratch_font_spec);
ASET (copy, FONT_TYPE_INDEX, driver_list->driver->type); ASET (copy, FONT_TYPE_INDEX, driver_list->driver->type);
XSETCDR (cache, Fcons (Fcons (copy, val), XCDR (cache))); XSETCDR (cache, Fcons (Fcons (copy, val), XCDR (cache)));
} }
...@@ -2755,7 +2755,7 @@ font_matching_entity (FRAME_PTR f, Lisp_Object *attrs, Lisp_Object spec) ...@@ -2755,7 +2755,7 @@ font_matching_entity (FRAME_PTR f, Lisp_Object *attrs, Lisp_Object spec)
struct font_driver_list *driver_list = f->font_driver_list; struct font_driver_list *driver_list = f->font_driver_list;
Lisp_Object ftype, size, entity; Lisp_Object ftype, size, entity;
Lisp_Object frame; Lisp_Object frame;
Lisp_Object work = Fcopy_font_spec (spec); Lisp_Object work = copy_font_spec (spec);
XSETFRAME (frame, f); XSETFRAME (frame, f);
ftype = AREF (spec, FONT_TYPE_INDEX); ftype = AREF (spec, FONT_TYPE_INDEX);
...@@ -2782,7 +2782,7 @@ font_matching_entity (FRAME_PTR f, Lisp_Object *attrs, Lisp_Object spec) ...@@ -2782,7 +2782,7 @@ font_matching_entity (FRAME_PTR f, Lisp_Object *attrs, Lisp_Object spec)
else else
{ {
entity = driver_list->driver->match (frame, work); entity = driver_list->driver->match (frame, work);
copy = Fcopy_font_spec (work); copy = copy_font_spec (work);
ASET (copy, FONT_TYPE_INDEX, driver_list->driver->type); ASET (copy, FONT_TYPE_INDEX, driver_list->driver->type);
XSETCDR (cache, Fcons (Fcons (copy, entity), XCDR (cache))); XSETCDR (cache, Fcons (Fcons (copy, entity), XCDR (cache)));
} }
...@@ -2976,7 +2976,7 @@ font_clear_prop (Lisp_Object *attrs, enum font_property_index prop) ...@@ -2976,7 +2976,7 @@ font_clear_prop (Lisp_Object *attrs, enum font_property_index prop)
if (! NILP (Ffont_get (font, QCname))) if (! NILP (Ffont_get (font, QCname)))
{ {
font = Fcopy_font_spec (font); font = copy_font_spec (font);
font_put_extra (font, QCname, Qnil); font_put_extra (font, QCname, Qnil);
} }
...@@ -2987,7 +2987,7 @@ font_clear_prop (Lisp_Object *attrs, enum font_property_index prop) ...@@ -2987,7 +2987,7 @@ font_clear_prop (Lisp_Object *attrs, enum font_property_index prop)
&& prop != FONT_SIZE_INDEX) && prop != FONT_SIZE_INDEX)
return; return;
if (EQ (font, attrs[LFACE_FONT_INDEX])) if (EQ (font, attrs[LFACE_FONT_INDEX]))
font = Fcopy_font_spec (font); font = copy_font_spec (font);
ASET (font, prop, Qnil); ASET (font, prop, Qnil);
if (prop == FONT_FAMILY_INDEX || prop == FONT_FOUNDRY_INDEX) if (prop == FONT_FAMILY_INDEX || prop == FONT_FOUNDRY_INDEX)
{ {
...@@ -3098,7 +3098,7 @@ font_find_for_lface (FRAME_PTR f, Lisp_Object *attrs, Lisp_Object spec, int c) ...@@ -3098,7 +3098,7 @@ font_find_for_lface (FRAME_PTR f, Lisp_Object *attrs, Lisp_Object spec, int c)
return Qnil; return Qnil;
} }
work = Fcopy_font_spec (spec); work = copy_font_spec (spec);
ASET (work, FONT_TYPE_INDEX, AREF (spec, FONT_TYPE_INDEX)); ASET (work, FONT_TYPE_INDEX, AREF (spec, FONT_TYPE_INDEX));
XSETFRAME (frame, f); XSETFRAME (frame, f);
pixel_size = font_pixel_size (f, spec); pixel_size = font_pixel_size (f, spec);
...@@ -3868,9 +3868,9 @@ usage: (font-spec ARGS...) */) ...@@ -3868,9 +3868,9 @@ usage: (font-spec ARGS...) */)
return spec; return spec;
} }
DEFUE ("copy-font-spec", Fcopy_font_spec, Scopy_font_spec, 1, 1, 0, /* Return a copy of FONT as a font-spec. */
doc: /* Return a copy of FONT as a font-spec. */) Lisp_Object
(Lisp_Object font) copy_font_spec (Lisp_Object font)
{ {
Lisp_Object new_spec, tail, prev, extra; Lisp_Object new_spec, tail, prev, extra;
int i; int i;
...@@ -3894,18 +3894,18 @@ DEFUE ("copy-font-spec", Fcopy_font_spec, Scopy_font_spec, 1, 1, 0, ...@@ -3894,18 +3894,18 @@ DEFUE ("copy-font-spec", Fcopy_font_spec, Scopy_font_spec, 1, 1, 0,
return new_spec; return new_spec;
} }
DEFUE ("merge-font-spec", Fmerge_font_spec, Smerge_font_spec, 2, 2, 0, /* Merge font-specs FROM and TO, and return a new font-spec.
doc: /* Merge font-specs FROM and TO, and return a new font-spec. Every specified property in FROM overrides the corresponding
Every specified properties in FROM override the corresponding property in TO. */
properties in TO. */) Lisp_Object
(Lisp_Object from, Lisp_Object to) merge_font_spec (Lisp_Object from, Lisp_Object to)
{ {
Lisp_Object extra, tail; Lisp_Object extra, tail;
int i; int i;
CHECK_FONT (from); CHECK_FONT (from);
CHECK_FONT (to); CHECK_FONT (to);
to = Fcopy_font_spec (to); to = copy_font_spec (to);
for (i = 0; i < FONT_EXTRA_INDEX; i++) for (i = 0; i < FONT_EXTRA_INDEX; i++)
ASET (to, i, AREF (from, i)); ASET (to, i, AREF (from, i));
extra = AREF (to, FONT_EXTRA_INDEX); extra = AREF (to, FONT_EXTRA_INDEX);
......
...@@ -737,8 +737,8 @@ struct font_data_list ...@@ -737,8 +737,8 @@ struct font_data_list
}; };
EXFUN (Ffont_spec, MANY); EXFUN (Ffont_spec, MANY);
EXFUN (Fcopy_font_spec, 1); extern Lisp_Object copy_font_spec (Lisp_Object);
EXFUN (Fmerge_font_spec, 2); extern Lisp_Object merge_font_spec (Lisp_Object, Lisp_Object);
EXFUN (Ffont_get, 2); EXFUN (Ffont_get, 2);
EXFUN (Ffont_put, 3); EXFUN (Ffont_put, 3);
EXFUN (Flist_fonts, 4); EXFUN (Flist_fonts, 4);
......
...@@ -1709,7 +1709,7 @@ int ...@@ -1709,7 +1709,7 @@ int
fontset_from_font (Lisp_Object font_object) fontset_from_font (Lisp_Object font_object)
{ {
Lisp_Object font_name = font_get_name (font_object); Lisp_Object font_name = font_get_name (font_object);
Lisp_Object font_spec = Fcopy_font_spec (font_object); Lisp_Object font_spec = copy_font_spec (font_object);
Lisp_Object registry = AREF (font_spec, FONT_REGISTRY_INDEX); Lisp_Object registry = AREF (font_spec, FONT_REGISTRY_INDEX);
Lisp_Object fontset_spec, alias, name, fontset; Lisp_Object fontset_spec, alias, name, fontset;
Lisp_Object val; Lisp_Object val;
...@@ -1726,7 +1726,7 @@ fontset_from_font (Lisp_Object font_object) ...@@ -1726,7 +1726,7 @@ fontset_from_font (Lisp_Object font_object)
sprintf (temp, "fontset-auto%d", num_auto_fontsets - 1); sprintf (temp, "fontset-auto%d", num_auto_fontsets - 1);
alias = intern (temp); alias = intern (temp);
} }
fontset_spec = Fcopy_font_spec (font_spec); fontset_spec = copy_font_spec (font_spec);
ASET (fontset_spec, FONT_REGISTRY_INDEX, alias); ASET (fontset_spec, FONT_REGISTRY_INDEX, alias);
name = Ffont_xlfd_name (fontset_spec, Qnil); name = Ffont_xlfd_name (fontset_spec, Qnil);
if (NILP (name)) if (NILP (name))
......
...@@ -1793,7 +1793,7 @@ the WIDTH times as wide as FACE on FRAME. */) ...@@ -1793,7 +1793,7 @@ the WIDTH times as wide as FACE on FRAME. */)
{ {
/* This is a scalable font. For backward compatibility, /* This is a scalable font. For backward compatibility,
we set the specified size. */ we set the specified size. */
font_entity = Fcopy_font_spec (font_entity); font_entity = copy_font_spec (font_entity);
ASET (font_entity, FONT_SIZE_INDEX, ASET (font_entity, FONT_SIZE_INDEX,
AREF (font_spec, FONT_SIZE_INDEX)); AREF (font_spec, FONT_SIZE_INDEX));
} }
...@@ -2317,9 +2317,9 @@ merge_face_vectors (struct frame *f, Lisp_Object *from, Lisp_Object *to, struct ...@@ -2317,9 +2317,9 @@ merge_face_vectors (struct frame *f, Lisp_Object *from, Lisp_Object *to, struct
if (!UNSPECIFIEDP (from[i])) if (!UNSPECIFIEDP (from[i]))
{ {
if (!UNSPECIFIEDP (to[i])) if (!UNSPECIFIEDP (to[i]))
to[i] = Fmerge_font_spec (from[i], to[i]); to[i] = merge_font_spec (from[i], to[i]);
else else
to[i] = Fcopy_font_spec (from[i]); to[i] = copy_font_spec (from[i]);
if (! NILP (AREF (to[i], FONT_FOUNDRY_INDEX))) if (! NILP (AREF (to[i], FONT_FOUNDRY_INDEX)))
to[LFACE_FOUNDRY_INDEX] = SYMBOL_NAME (AREF (to[i], FONT_FOUNDRY_INDEX)); to[LFACE_FOUNDRY_INDEX] = SYMBOL_NAME (AREF (to[i], FONT_FOUNDRY_INDEX));
if (! NILP (AREF (to[i], FONT_FAMILY_INDEX))) if (! NILP (AREF (to[i], FONT_FAMILY_INDEX)))
......
...@@ -739,7 +739,7 @@ xfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size) ...@@ -739,7 +739,7 @@ xfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size)
So, we try again with wildcards in RESX and RESY. */ So, we try again with wildcards in RESX and RESY. */
Lisp_Object temp; Lisp_Object temp;
temp = Fcopy_font_spec (entity); temp = copy_font_spec (entity);
ASET (temp, FONT_DPI_INDEX, Qnil); ASET (temp, FONT_DPI_INDEX, Qnil);
len = font_unparse_xlfd (temp, pixel_size, name, 512); len = font_unparse_xlfd (temp, pixel_size, name, 512);
if (len <= 0 || (len = xfont_encode_coding_xlfd (name)) < 0) if (len <= 0 || (len = xfont_encode_coding_xlfd (name)) < 0)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment