--- xbattbar.c.upstream	Sat Jan 12 01:11:08 2002
+++ xbattbar.c	Sat Jan 12 02:14:56 2002
@@ -45,7 +45,7 @@
 #define BI_Vertical	((bi_direction & 2) == 2)
 
 #define myEventMask (ExposureMask|EnterWindowMask|LeaveWindowMask|VisibilityChangeMask)
-#define DefaultFont "fixed"
+#define DefaultFont "7x13bold"
 #define DiagXMergin 20
 #define DiagYMergin 5
 
@@ -79,6 +79,8 @@
 int bi_thick = BI_THICKNESS;        /* thickness of Battery Indicator */
 int bi_interval = PollingInterval;  /* interval of polling APM */
 
+char *diag_font = DefaultFont;
+
 Display *disp;
 Window winbar;                  /* bar indicator window */
 Window winstat = -1;            /* battery status window */
@@ -122,6 +124,7 @@
     "\t\t[ top | bottom | left | right ]\n"
     "-a:     always on top.\n"
     "-v, -h: show this message.\n"
+    "-F:     font.\n"
     "-t:     bar (indicator) thickness. [def: 3 pixels]\n"
     "-p:     polling interval. [def: 10 sec.]\n"
     "-I, -O: bar colors in AC on-line. [def: \"green\" & \"olive drab\"]\n"
@@ -177,6 +180,11 @@
     exit(1);
   }
 
+  if (XLoadQueryFont(disp, diag_font) == NULL) {
+    fprintf(stderr, "xbattbar: font %s not found\n", optarg);
+    exit(1);
+  }
+
   switch (bi_direction) {
   case BI_Top: /* (0,0) - (width, bi_thick) */
     bi_width = width;
@@ -223,7 +231,7 @@
   int ch;
 
   about_this_program();
-  while ((ch = getopt(argc, argv, "at:f:hI:i:O:o:p:v")) != -1)
+  while ((ch = getopt(argc, argv, "at:f:hI:i:O:o:p:F:v")) != -1)
     switch (ch) {
     case 'a':
       alwaysontop = True;
@@ -251,6 +259,10 @@
       bi_interval = atoi(optarg);
       break;
 
+    case 'F':
+      diag_font = optarg;
+      break;
+
     case 'h':
     case 'v':
       usage(argv);
@@ -344,7 +356,7 @@
   sprintf(diagmsg,
          "AC %s-line: battery level is %d%%",
          ac_line ? "on" : "off", battery_level);
-  fontp = XLoadQueryFont(disp, DefaultFont);
+  fontp = XLoadQueryFont(disp, diag_font);
   pixw = XTextWidth(fontp, diagmsg, strlen(diagmsg));
   pixh = fontp->ascent + fontp->descent;
   boxw = pixw + DiagXMergin * 2;

