set_char_table_extras (fontset, 1, name);
}
-#define FONTSET_ASCII(fontset) XCHAR_TABLE (fontset)->extras[4]
+#define FONTSET_ASCII(fontset) XCHAR_TABLE (fontset)->extras[2]
static void
set_fontset_ascii (Lisp_Object fontset, Lisp_Object ascii)
{
- set_char_table_extras (fontset, 4, ascii);
+ set_char_table_extras (fontset, 2, ascii);
}
/* Access special values of (realized) FONTSET. */
-#define FONTSET_BASE(fontset) XCHAR_TABLE (fontset)->extras[2]
+#define FONTSET_BASE(fontset) XCHAR_TABLE (fontset)->extras[3]
static void
set_fontset_base (Lisp_Object fontset, Lisp_Object base)
{
- set_char_table_extras (fontset, 2, base);
+ set_char_table_extras (fontset, 3, base);
}
-#define FONTSET_FRAME(fontset) XCHAR_TABLE (fontset)->extras[3]
+#define FONTSET_FRAME(fontset) XCHAR_TABLE (fontset)->extras[4]
static void
set_fontset_frame (Lisp_Object fontset, Lisp_Object frame)
{
- set_char_table_extras (fontset, 3, frame);
+ set_char_table_extras (fontset, 4, frame);
}
#define FONTSET_NOFONT_FACE(fontset) XCHAR_TABLE (fontset)->extras[5]
set_char_table_extras (fontset, 5, face);
}
-#define FONTSET_DEFAULT(fontset) XCHAR_TABLE (fontset)->extras[7]
+#define FONTSET_DEFAULT(fontset) XCHAR_TABLE (fontset)->extras[6]
static void
set_fontset_default (Lisp_Object fontset, Lisp_Object def)
{
- set_char_table_extras (fontset, 7, def);
+ set_char_table_extras (fontset, 6, def);
}
/* For both base and realized fontset. */
-#define FONTSET_FALLBACK(fontset) XCHAR_TABLE (fontset)->extras[8]
+#define FONTSET_FALLBACK(fontset) XCHAR_TABLE (fontset)->extras[7]
static void
set_fontset_fallback (Lisp_Object fontset, Lisp_Object fallback)
{
- set_char_table_extras (fontset, 8, fallback);
+ set_char_table_extras (fontset, 7, fallback);
}
#define BASE_FONTSET_P(fontset) (NILP (FONTSET_BASE (fontset)))
return elt;
}
-static void
-free_realized_fontset (struct frame *f, Lisp_Object fontset)
-{
-#if 0
- Lisp_Object tail;
-
- if (0)
- for (tail = FONTSET_OBJLIST (fontset); CONSP (tail); tail = XCDR (tail))
- {
- eassert (FONT_OBJECT_P (XCAR (tail)));
- font_close_object (f, XCAR (tail));
- }
-#endif
-}
-
/* Free fontset of FACE defined on frame F. Called from
free_realized_face. */
return;
eassert (! BASE_FONTSET_P (fontset));
eassert (f == XFRAME (FONTSET_FRAME (fontset)));
- free_realized_fontset (f, fontset);
ASET (Vfontset_table, face->fontset, Qnil);
if (face->fontset < next_fontset_id)
next_fontset_id = face->fontset;
fontset = AREF (Vfontset_table, id);
eassert (!NILP (fontset) && ! BASE_FONTSET_P (fontset));
eassert (f == XFRAME (FONTSET_FRAME (fontset)));
- free_realized_fontset (f, fontset);
ASET (Vfontset_table, id, Qnil);
if (id < next_fontset_id)
next_fontset_id = face->fontset;
/* If PATTERN is not full XLFD we convert "*" to ".*". Otherwise
we convert "*" to "[^-]*" which is much faster in regular
expression matching. */
- if (ndashes < 14)
- p1 = regex = alloca (SBYTES (pattern) + 2 * nstars + 2 * nescs + 1);
- else
- p1 = regex = alloca (SBYTES (pattern) + 5 * nstars + 2 * nescs + 1);
+ ptrdiff_t regexsize = (SBYTES (pattern)
+ + (ndashes < 14 ? 2 : 5) * nstars
+ + 2 * nescs + 1);
+ USE_SAFE_ALLOCA;
+ p1 = regex = SAFE_ALLOCA (regexsize);
*p1++ = '^';
for (p0 = SDATA (pattern); *p0; p0++)
Vcached_fontset_data = Fcons (build_string (SSDATA (pattern)),
build_string ((char *) regex));
+ SAFE_FREE ();
}
return CACHED_FONTSET_REGEX;
registry = AREF (font_spec, FONT_REGISTRY_INDEX);
if (! NILP (registry))
registry = Fdowncase (SYMBOL_NAME (registry));
- encoding = find_font_encoding (concat3 (family, build_string ("-"),
- registry));
+ AUTO_STRING (dash, "-");
+ encoding = find_font_encoding (concat3 (family, dash, registry));
if (NILP (encoding))
encoding = Qascii;
if (ascii_changed)
{
- Lisp_Object tail, fr, alist;
+ Lisp_Object tail, fr;
int fontset_id = XINT (FONTSET_ID (fontset));
set_fontset_ascii (fontset, fontname);
if (! NILP (font_object))
{
update_auto_fontset_alist (font_object, fontset);
- alist = list1 (Fcons (Qfont, Fcons (name, font_object)));
- Fmodify_frame_parameters (fr, alist);
+ AUTO_FRAME_ARG (arg, Qfont, Fcons (name, font_object));
+ Fmodify_frame_parameters (fr, arg);
}
}
}
return Qnil;
if (!FRAME_WINDOW_P (f))
return Qnil;
+ /* We need the basic faces to be valid below, so recompute them if
+ some code just happened to clear the face cache. */
+ if (FRAME_FACE_CACHE (f)->used == 0)
+ recompute_basic_faces (f);
face_id = FACE_FOR_CHAR (f, FACE_FROM_ID (f, face_id), c, pos, Qnil);
face = FACE_FROM_ID (f, face_id);
if (face->font)
/* Recode fontsets realized on FRAME from the base fontset FONTSET
in the table `realized'. */
- realized[0] = alloca (word_size * ASIZE (Vfontset_table));
+ USE_SAFE_ALLOCA;
+ SAFE_ALLOCA_LISP (realized[0], 2 * ASIZE (Vfontset_table));
+ realized[1] = realized[0] + ASIZE (Vfontset_table);
for (i = j = 0; i < ASIZE (Vfontset_table); i++)
{
elt = FONTSET_FROM_ID (i);
}
realized[0][j] = Qnil;
- realized[1] = alloca (word_size * ASIZE (Vfontset_table));
for (i = j = 0; ! NILP (realized[0][i]); i++)
{
elt = FONTSET_DEFAULT (realized[0][i]);
break;
}
+ SAFE_FREE ();
return tables[0];
}
syms_of_fontset (void)
{
DEFSYM (Qfontset, "fontset");
- Fput (Qfontset, Qchar_table_extra_slots, make_number (9));
+ Fput (Qfontset, Qchar_table_extra_slots, make_number (8));
DEFSYM (Qfontset_info, "fontset-info");
Fput (Qfontset_info, Qchar_table_extra_slots, make_number (1));