summaryrefslogtreecommitdiff
path: root/app/fvwm/libs/GetFontSet.c
diff options
context:
space:
mode:
authorMatthieu Herrb <matthieu@cvs.openbsd.org>2006-11-26 10:53:58 +0000
committerMatthieu Herrb <matthieu@cvs.openbsd.org>2006-11-26 10:53:58 +0000
commit1cb4778bcef21ea9015cfccdb99abb7a0e035d74 (patch)
treef164009397f9d3d5634c6f8a94b1542f793d9692 /app/fvwm/libs/GetFontSet.c
parent841f8331c93ff96bd798e9a74ba10fab155da5c5 (diff)
Importing from XF4, plus BSD make infrastructure
Diffstat (limited to 'app/fvwm/libs/GetFontSet.c')
-rw-r--r--app/fvwm/libs/GetFontSet.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/app/fvwm/libs/GetFontSet.c b/app/fvwm/libs/GetFontSet.c
new file mode 100644
index 000000000..47c198ae2
--- /dev/null
+++ b/app/fvwm/libs/GetFontSet.c
@@ -0,0 +1,38 @@
+/* This file brings from GetFont.c */
+
+#include "../configure.h"
+
+#include <stdio.h>
+#include <unistd.h>
+#include <stdlib.h>
+
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+
+#include "fvwmlib.h"
+
+/*
+** loads fontset or "fixed" on failure
+*/
+XFontSet GetFontSetOrFixed(Display *disp, char *fontname)
+{
+ XFontSet fontset;
+ char **ml;
+ int mc;
+ char *ds;
+
+ if ((fontset = XCreateFontSet(disp,fontname,&ml,&mc,&ds))==NULL)
+ {
+ fprintf(stderr,
+ "[FVWM][GetFontSetOrFixed]: WARNING -- can't get fontset %s, trying 'fixed'\n",
+ fontname);
+ /* fixed should always be avail, so try that */
+ /* plain X11R6.3 hack */
+ if ((fontset = XCreateFontSet(disp,"fixed,-*--14-*",&ml,&mc,&ds))==NULL)
+ {
+ fprintf(stderr,"[FVWM][GetFontSetOrFixed]: ERROR -- can't get fontset 'fixed'\n");
+ }
+ }
+ return fontset;
+}
+