Put fonts in font table in allocated memory after sizing
authorH.G.Muller <hgm@hgm-xboard.(none)>
Wed, 6 Apr 2016 08:49:53 +0000 (10:49 +0200)
committerH.G.Muller <hgm@hgm-xboard.(none)>
Sun, 17 Apr 2016 08:24:58 +0000 (10:24 +0200)
To make it possible to change the font later it should always be
put in allocated memory.

gtk/xboard.c

index c68d85f..c6579d8 100644 (file)
@@ -1693,9 +1693,9 @@ ReSize (WindowPlacement *wp)
        for(h=0; sizeDefaults[h].name && sizeDefaults[h].squareSize*8 > sqx*BOARD_WIDTH; h++) {}
        if(initialSquareSize != sizeDefaults[h].squareSize) { // boardSize changed
            initialSquareSize = sizeDefaults[h].squareSize; // used for saving font
        for(h=0; sizeDefaults[h].name && sizeDefaults[h].squareSize*8 > sqx*BOARD_WIDTH; h++) {}
        if(initialSquareSize != sizeDefaults[h].squareSize) { // boardSize changed
            initialSquareSize = sizeDefaults[h].squareSize; // used for saving font
-           if(!fontValid[CLOCK_FONT][initialSquareSize]) fontTable[CLOCK_FONT][initialSquareSize] = CLOCK_FONT_NAME;
+           if(!fontValid[CLOCK_FONT][initialSquareSize]) { ASSIGN(fontTable[CLOCK_FONT][initialSquareSize], CLOCK_FONT_NAME); }
            appData.clockFont = InsertPxlSize(fontTable[CLOCK_FONT][initialSquareSize], 2*(sizeDefaults[h].clockFontPxlSize+1)/3);
            appData.clockFont = InsertPxlSize(fontTable[CLOCK_FONT][initialSquareSize], 2*(sizeDefaults[h].clockFontPxlSize+1)/3);
-           if(!fontValid[MESSAGE_FONT][initialSquareSize]) fontTable[MESSAGE_FONT][initialSquareSize] = DEFAULT_FONT_NAME;
+           if(!fontValid[MESSAGE_FONT][initialSquareSize]) { ASSIGN(fontTable[MESSAGE_FONT][initialSquareSize], DEFAULT_FONT_NAME); }
            appData.font = InsertPxlSize(fontTable[MESSAGE_FONT][initialSquareSize], sizeDefaults[h].coordFontPxlSize);
            DisplayBothClocks();
            ApplyFont(&mainOptions[W_MESSG], NULL);
            appData.font = InsertPxlSize(fontTable[MESSAGE_FONT][initialSquareSize], sizeDefaults[h].coordFontPxlSize);
            DisplayBothClocks();
            ApplyFont(&mainOptions[W_MESSG], NULL);