# include "Ximage.h"

/************** LoadFont *************/
void
LoadFont (graphic, argc, argv, default_name)
Graphic   graphic[];
int      *argc;
char     *argv[];
char      default_name[];
{

  char name[400];

  strcpy (name, default_name);
  CheckFontName (argc, argv, name);
  graphic[0].font = XLoadQueryFont (graphic[0].display, name);
  if (graphic[0].font == (XFontStruct *) NULL) {
    fprintf (stderr, "Could not load fond %s, using %s\n", name, default_name);
    graphic[0].font = XLoadQueryFont (graphic[0].display, default_name);
    if (graphic[0].font == (XFontStruct *) NULL) {
      graphic[0].font = XLoadQueryFont (graphic[0].display, "fixed");
      fprintf (stderr, "Could not load fond %s, using %s\n", 
	       default_name, "fixed");
    }
  }
  if (graphic[0].font != (XFontStruct *) NULL) 
    XSetFont (graphic[0].display, graphic[0].gc, graphic[0].font[0].fid);
  else
    QuitX (graphic[0].display, "Error: could not load font", name);
}

