Binary files xsmc-calc-1.0.0/calc.o and xsmc-calc-1.0.0.fonts/calc.o differ Binary files xsmc-calc-1.0.0/dialog.o and xsmc-calc-1.0.0.fonts/dialog.o differ Binary files xsmc-calc-1.0.0/draw.o and xsmc-calc-1.0.0.fonts/draw.o differ diff -r -u xsmc-calc-1.0.0/Makefile xsmc-calc-1.0.0.fonts/Makefile --- xsmc-calc-1.0.0/Makefile 2013-01-18 16:14:12.000000000 -0800 +++ xsmc-calc-1.0.0.fonts/Makefile 2013-01-19 20:07:12.062819334 -0800 @@ -2,21 +2,21 @@ xsmc: smc.o calc.o draw.o dialog.o - gcc -oxsmc -Wall smc.o calc.o draw.o dialog.o -L/usr/X11R6/lib -lX11 -lm + gcc ${CFLAGS} -oxsmc -Wall smc.o calc.o draw.o dialog.o -L/usr/X11R6/lib -lX11 -lm { gzip *.1*; true; } # smc.o: smc.c - gcc -Wall -c smc.c + gcc ${CFLAGS} -Wall -c smc.c calc.o: calc.c - gcc -Wall -c calc.c + gcc ${CFLAGS} -Wall -c calc.c draw.o: draw.c - gcc -Wall -c draw.c + gcc ${CFLAGS} -Wall -c draw.c dialog.o: dialog.c - gcc -Wall -c dialog.c + gcc ${CFLAGS} -Wall -c dialog.c # # diff -r -u xsmc-calc-1.0.0/smc.c xsmc-calc-1.0.0.fonts/smc.c --- xsmc-calc-1.0.0/smc.c 2013-01-18 16:14:12.000000000 -0800 +++ xsmc-calc-1.0.0.fonts/smc.c 2013-01-19 20:16:11.708035074 -0800 @@ -62,6 +62,28 @@ const float tunesteptab[6]={1.01, 1.02, 1.05, 1.1, 1.2, 1.5}; float tunestep; int Zcirc=1, Ycirc=0, RHOcirc=0, Qcirc=0; + +/* try several font name patterns */ +void tryfonts( + XFontStruct **fontstr, + char **fontnames, + int fontcount) { + int i; + + for (i = 0; i < fontcount; i++) { + *fontstr = XLoadQueryFont( display, fontnames[i]); + if (*fontstr == 0) + fprintf(stderr, "Unable to load font: %s\n", fontnames[i]); + else { + fprintf(stderr, "Using font: %s\n", fontnames[i]); + return; + } + } + if (*fontstr == 0) + exit( 1); +} + + int main(int argc, char** argv) { int clo, needupdate=1, i, tsidx=3, Keyshift=0, x, y, curswhere=0; char b[40], c; @@ -141,10 +163,18 @@ gc=XCreateGC(display, window, 0, 0); - fontdialogname=XLoadQueryFont(display, "*-helvetica-medium-r-normal--12*"); - if(!fontdialogname) fprintf(stderr, "Unable to load font\n"); - fontchartname=XLoadQueryFont(display, "*helvetica*6*"); - if(!fontchartname) fprintf(stderr, "Unable to load font\n"); + { /* try other fonts if helvetica not available */ + char *dialogfonts[] = { "*-helvetica-medium-r-normal--12*", + "*-fixed-medium-*--12*", + "*-fixed-*--12*"}; + char *chartfonts[] = { "*-helvetica-*--6*", + "*-fixed-medium-*--6*", + "*-fixed-*--6*"}; + + tryfonts( &fontdialogname, dialogfonts, sizeof( dialogfonts) / sizeof( char *)); + + tryfonts( &fontchartname, chartfonts, sizeof( chartfonts) / sizeof( char *)); + } XSelectInput(display, window, ExposureMask|KeyPressMask|KeyReleaseMask|PointerMotionMask); @@ -439,7 +469,7 @@ } } - + return 0; } Binary files xsmc-calc-1.0.0/smc.o and xsmc-calc-1.0.0.fonts/smc.o differ Binary files xsmc-calc-1.0.0/xsmc and xsmc-calc-1.0.0.fonts/xsmc differ