From: Eric Mullins Date: Sun, 18 Oct 2009 17:32:55 +0000 (-0600) Subject: Changes to allow fonts with any charset (such as terminal) X-Git-Tag: v4.4.1.20091019~7 X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=f9cda3698df8b588c7d2174bc7c5effb919c34bc;p=xboard.git Changes to allow fonts with any charset (such as terminal) Affects winboard only. --- diff --git a/winboard/winboard.c b/winboard/winboard.c index 62d5072..31afd62 100644 --- a/winboard/winboard.c +++ b/winboard/winboard.c @@ -1496,6 +1496,10 @@ ParseFontName(char *name, MyFontParams *mfp) mfp->italic = (strchr(p, 'i') != NULL); mfp->underline = (strchr(p, 'u') != NULL); mfp->strikeout = (strchr(p, 's') != NULL); + mfp->charset = DEFAULT_CHARSET; + q = strchr(p, 'c'); + if (q) + mfp->charset = (BYTE) atoi(q+1); } /* Color name parser. @@ -1870,7 +1874,7 @@ LFfromMFP(LOGFONT* lf, MyFontParams *mfp) lf->lfItalic = mfp->italic; lf->lfUnderline = mfp->underline; lf->lfStrikeOut = mfp->strikeout; - lf->lfCharSet = DEFAULT_CHARSET; + lf->lfCharSet = mfp->charset; lf->lfOutPrecision = OUT_DEFAULT_PRECIS; lf->lfClipPrecision = CLIP_DEFAULT_PRECIS; lf->lfQuality = DEFAULT_QUALITY; @@ -2493,13 +2497,14 @@ SaveSettings(char* name) for (bs=0; bsargLoc]->mfp; fprintf(f, "/size=%s ", sizeInfo[bs].name); - fprintf(f, "/%s=\"%s:%g%s%s%s%s%s\"\n", + fprintf(f, "/%s=\"%s:%g%s%s%s%s%sc%d\"\n", ad->argName, mfp->faceName, mfp->pointSize, mfp->bold || mfp->italic || mfp->underline || mfp->strikeout ? " " : "", mfp->bold ? "b" : "", mfp->italic ? "i" : "", mfp->underline ? "u" : "", - mfp->strikeout ? "s" : ""); + mfp->strikeout ? "s" : "", + (int)mfp->charset); } } break; diff --git a/winboard/winboard.h b/winboard/winboard.h index fab659e..973aab6 100644 --- a/winboard/winboard.h +++ b/winboard/winboard.h @@ -59,6 +59,7 @@ typedef struct { char faceName[LF_FACESIZE]; float pointSize; BYTE bold, italic, underline, strikeout; + BYTE charset; } MyFontParams; typedef struct { diff --git a/winboard/woptions.c b/winboard/woptions.c old mode 100644 new mode 100755 index 46f0e4b..aaab83b --- a/winboard/woptions.c +++ b/winboard/woptions.c @@ -1010,6 +1010,7 @@ MyCreateFont(HWND hwnd, MyFont *font) font->mfp.italic = font->lf.lfItalic; font->mfp.underline = font->lf.lfUnderline; font->mfp.strikeout = font->lf.lfStrikeOut; + font->mfp.charset = font->lf.lfCharSet; strcpy(font->mfp.faceName, font->lf.lfFaceName); return TRUE; } @@ -1021,7 +1022,7 @@ UpdateSampleText(HWND hDlg, int id, MyColorizeAttribs *mca) CHARFORMAT cf; cf.cbSize = sizeof(CHARFORMAT); cf.dwMask = - CFM_COLOR|CFM_BOLD|CFM_ITALIC|CFM_UNDERLINE|CFM_STRIKEOUT|CFM_FACE|CFM_SIZE; + CFM_COLOR|CFM_CHARSET|CFM_BOLD|CFM_ITALIC|CFM_UNDERLINE|CFM_STRIKEOUT|CFM_FACE|CFM_SIZE; cf.crTextColor = mca->color; cf.dwEffects = mca->effects; strcpy(cf.szFaceName, font[boardSize][CONSOLE_FONT]->mfp.faceName); @@ -1265,7 +1266,9 @@ IcsOptionsDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) appData.colorize = (Boolean)!IsDlgButtonChecked(hDlg, OPT_DontColorize); - if (!appData.colorize) { + ChangedConsoleFont(); + + if (!appData.colorize) { CHARFORMAT cf; COLORREF background = ParseColorName(COLOR_BKGD); /* @@ -1275,7 +1278,7 @@ IcsOptionsDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) cf.cbSize = sizeof(CHARFORMAT); cf.dwMask = CFM_COLOR; cf.crTextColor = ParseColorName(COLOR_NORMAL); - + SendDlgItemMessage(hwndConsole, OPT_ConsoleInput, EM_SETCHARFORMAT, SCF_ALL, (LPARAM)&cf); SendDlgItemMessage(hwndConsole, OPT_ConsoleText, @@ -1495,6 +1498,7 @@ CopyFont(MyFont *dest, const MyFont *src) dest->mfp.italic = src->mfp.italic; dest->mfp.underline = src->mfp.underline; dest->mfp.strikeout = src->mfp.strikeout; + dest->mfp.charset = src->mfp.charset; lstrcpy(dest->mfp.faceName, src->mfp.faceName); CreateFontInMF(dest); }