/* Cache for FT_Face and FcCharSet. */
static Lisp_Object ft_face_cache;
-/* The actual structure for FreeType font that can be casted to struct
+/* The actual structure for FreeType font that can be cast to struct
font. */
struct ftfont_info
static void ftfont_filter_properties (Lisp_Object font, Lisp_Object alist);
-Lisp_Object ftfont_font_format (FcPattern *, Lisp_Object);
-
#define SYMBOL_FcChar8(SYM) (FcChar8 *) SDATA (SYMBOL_NAME (SYM))
static struct
static struct OpenTypeSpec *
ftfont_get_open_type_spec (Lisp_Object otf_spec)
{
- struct OpenTypeSpec *spec = malloc (sizeof *spec);
+ struct OpenTypeSpec *spec = xmalloc_unsafe (sizeof *spec);
Lisp_Object val;
int i, j;
bool negative;
spec->features[i] =
(min (PTRDIFF_MAX, SIZE_MAX) / sizeof (int) < XINT (len)
? 0
- : malloc (XINT (len) * sizeof *spec->features[i]));
+ : xmalloc_atomic_unsafe (XINT (len) * sizeof *spec->features[i]));
if (! spec->features[i])
{
if (i > 0 && spec->features[0])
- free (spec->features[0]);
- free (spec);
+ xfree (spec->features[0]);
+ xfree (spec);
return NULL;
}
for (j = 0, negative = 0; CONSP (val); val = XCDR (val))
if (*otspec)
{
if ((*otspec)->nfeatures[0] > 0)
- free ((*otspec)->features[0]);
+ xfree ((*otspec)->features[0]);
if ((*otspec)->nfeatures[1] > 0)
- free ((*otspec)->features[1]);
- free (*otspec);
+ xfree ((*otspec)->features[1]);
+ xfree (*otspec);
*otspec = NULL;
}
if (otspec)
{
FcChar8 *file;
+ bool passed;
OTF *otf;
if (FcPatternGetString (fontset->fonts[i], FC_FILE, 0, &file)
otf = OTF_open ((char *) file);
if (! otf)
continue;
- if (OTF_check_features (otf, 1,
- otspec->script_tag, otspec->langsys_tag,
- otspec->features[0],
- otspec->nfeatures[0]) != 1
- || OTF_check_features (otf, 0,
- otspec->script_tag, otspec->langsys_tag,
- otspec->features[1],
- otspec->nfeatures[1]) != 1)
+ passed = (OTF_check_features (otf, 1, otspec->script_tag,
+ otspec->langsys_tag,
+ otspec->features[0],
+ otspec->nfeatures[0]) == 1
+ && OTF_check_features (otf, 0, otspec->script_tag,
+ otspec->langsys_tag,
+ otspec->features[1],
+ otspec->nfeatures[1]) == 1);
+ OTF_close (otf);
+ if (!passed)
continue;
}
#endif /* HAVE_LIBOTF */