File: GetFont.c

package info (click to toggle)
fvwm2 2.0.46-BETA-3
  • links: PTS
  • area: main
  • in suites: hamm
  • size: 5,172 kB
  • ctags: 5,559
  • sloc: ansic: 52,902; cpp: 2,465; perl: 2,275; python: 779; sh: 604; makefile: 221
file content (32 lines) | stat: -rw-r--r-- 668 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include "../configure.h"

#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>

#include <X11/Xlib.h>
#include <X11/Xutil.h>

#include "fvwmlib.h"

/*
** loads font or "fixed" on failure
*/
XFontStruct *GetFontOrFixed(Display *disp, char *fontname)
{
  XFontStruct *fnt;

  if ((fnt = XLoadQueryFont(disp,fontname))==NULL)
  {
    fprintf(stderr,
            "[GetFontOrFixed]: WARNING -- can't get font %s, trying 'fixed'",
            fontname);
    /* fixed should always be avail, so try that */
    if ((fnt = XLoadQueryFont(disp,"fixed"))==NULL) 
    {
      fprintf(stderr,"[GetFontOrFixed]: ERROR -- can't get font 'fixed'");
    }
  }
  return fnt;
}