/* Copyright 1998 DJ Delorie Distributed under the terms of the GNU GPL http://www.delorie.com/store/hcalc/ Revisions copyright 2007, Theodore Kilgore More revisions copyright 2023, B. Watson */ #include "hcalc.h" #include #define xpm face0_data #include "xpm/face.xpm" #undef xpm #define xpm face1_data #include "xpm/face.250.xpm" #undef xpm #define xpm face2_data #include "xpm/face.500.xpm" #undef xpm #define xpm chars0_data #include "xpm/chars.xpm" #undef xpm #define xpm chars1_data #include "xpm/chars.250.xpm" #undef xpm #define xpm chars2_data #include "xpm/chars.500.xpm" #undef xpm static char **faces[3] = { face0_data, face1_data, face2_data }; static char **charss[3] = { chars0_data, chars1_data, chars2_data }; static int c_factors[3] = { 6, 12, 24 }; Pixmap face; Pixmap chars; char charmap[] = " 0123456789ABCDEF-x,.ro+"; int char_to_x[256]; void free_pixmaps(void) { if(face) XFreePixmap(display, face); if(chars) XFreePixmap(display, chars); } void load_pixmaps(void) { int i, c; XpmAttributes attr; attr.valuemask = 0; XpmCreatePixmapFromData(display, window, faces[winsize], &face, 0, &attr); XpmCreatePixmapFromData(display, window, charss[winsize], &chars, 0, &attr); for(i = 0; i < 256; i++) { char_to_x[i] = 0; for(c = 0; charmap[c]; c++) if(charmap[c] == i) { char_to_x[i] = c * c_factors[winsize]; /* printf("char_to_x[%d] ('%c') = %d\n", i, i, c*C_FACTOR); */ } } }