summaryrefslogtreecommitdiff
path: root/do_text.c
diff options
context:
space:
mode:
Diffstat (limited to 'do_text.c')
-rw-r--r--do_text.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/do_text.c b/do_text.c
index 8d28def..355ba8d 100644
--- a/do_text.c
+++ b/do_text.c
@@ -409,6 +409,8 @@ InitAAText(XParms xp, Parms p, int64_t reps)
{
char ch;
XRenderColor color;
+ FcValue value;
+ int v_len;
aafont = XftFontOpenName (xp->d, DefaultScreen (xp->d), p->font);
@@ -418,6 +420,22 @@ InitAAText(XParms xp, Parms p, int64_t reps)
p->font);
return 0;
}
+ if (FcPatternGet(aafont->pattern, FC_FAMILY, 0, &value) != FcResultMatch ||
+ value.type != FcTypeString)
+ {
+ printf("Could not load font '%s', benchmark omitted\n",
+ p->font);
+ XftFontClose (xp->d, aafont);
+ return 0;
+ }
+ v_len = strlen((char *) value.u.s);
+ if (strncmp((char *) value.u.s, p->font, v_len) != 0 || p->font[v_len] != ':') {
+ printf("Could not load font '%s' (found %s), benchmark omitted\n",
+ p->font,
+ (char *) value.u.s);
+ XftFontClose (xp->d, aafont);
+ return 0;
+ }
aadraw = XftDrawCreate (xp->d, xp->w,
xp->vinfo.visual,