X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=xboard.c;h=59800f92af829cdab2e696ac6ecf58a264666d77;hb=dc0bff62fbb2d491ed088ba2abdf1e5c99ec2755;hp=a9f89918ebe0abd6e3693232ad4e91f2cbaa66e3;hpb=fe8983ace70a1fe3f24e47e5d352a7d8edb95dd5;p=xboard.git diff --git a/xboard.c b/xboard.c index a9f8991..59800f9 100644 --- a/xboard.c +++ b/xboard.c @@ -1296,9 +1296,25 @@ colorVariable[] = { NULL }; +// [HGM] font: keep a font for each square size, even non-stndard ones +#define NUM_SIZES 18 +#define MAX_SIZE 130 +Boolean fontSet[NUM_FONTS], fontValid[NUM_FONTS][MAX_SIZE]; +char *fontTable[NUM_FONTS][MAX_SIZE]; + void ParseFont(char *name, int number) { // in XBoard, only 2 of the fonts are currently implemented, and we just copy their name + int size; + if(sscanf(name, "size%d:", &size)) { + // [HGM] font: font is meant for specific boardSize (likely from settings file); + // defer processing it until we know if it matches our board size + if(size >= 0 && sizeargLoc) { + char *name, buf[MSG_SIZ]; + int i, n = (int)ad->argLoc; + switch(n) { case 0: // CLOCK_FONT name = appData.clockFont; break; @@ -1373,9 +1391,14 @@ SaveFontArg(FILE *f, ArgDescriptor *ad) default: return; } -// Do not save fonts for now, as the saved font would be board-size specific -// and not suitable for a re-start at another board size -// fprintf(f, OPTCHAR "%s" SEPCHAR "%s\n", ad->argName, name); + for(i=0; iargName, i, fontTable[n][i]); } void @@ -1816,7 +1839,14 @@ main(argc, argv) fontPxlSize = szd->fontPxlSize; smallLayout = szd->smallLayout; tinyLayout = szd->tinyLayout; - } + // [HGM] font: use defaults from settings file if available and not overruled + } + if(!fontSet[CLOCK_FONT] && fontValid[CLOCK_FONT][squareSize]) + appData.clockFont = fontTable[CLOCK_FONT][squareSize]; + if(!fontSet[MESSAGE_FONT] && fontValid[MESSAGE_FONT][squareSize]) + appData.font = fontTable[MESSAGE_FONT][squareSize]; + if(!fontSet[COORD_FONT] && fontValid[COORD_FONT][squareSize]) + appData.coordFont = fontTable[COORD_FONT][squareSize]; /* Now, using squareSize as a hint, find a good XPM/XIM set size */ if (strlen(appData.pixmapDirectory) > 0) {