# include "Ximage.h"

/************** LoadFont *************/
void LoadFont (int *argc, char **argv, char *default_name) {

  char name[400];
  char *temp_name;

  temp_name = XGetDefault (graphic.display, argv[0], "Font");
  if (temp_name == (char *) NULL) 
    strcpy (name, default_name);
  else 
    strcpy (name, temp_name);

  CheckFontName (argc, argv, name);

  graphic.font = XLoadQueryFont (graphic.display, name);
  if (graphic.font == (XFontStruct *) NULL) {
    fprintf (stderr, "Could not load fond %s, using %s\n", name, default_name);
    graphic.font = XLoadQueryFont (graphic.display, default_name);
    if (graphic.font == (XFontStruct *) NULL) {
      graphic.font = XLoadQueryFont (graphic.display, "fixed");
      fprintf (stderr, "Could not load fond %s, using %s\n", default_name, "fixed");
    }
  }

  if (graphic.font != (XFontStruct *) NULL) 
    XSetFont (graphic.display, graphic.gc, graphic.font[0].fid);
  else
    QuitX (graphic.display, "Error: could not load font", name);
}
