mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-06-30 19:12:48 -05:00
Configurable font quality on Windows. (Together with a little bit of
macro stuff to cope with the inadequacy of VC++ 6 headers.) [originally from svn r6519]
This commit is contained in:
@ -172,6 +172,20 @@ void win_setup_config_box(struct controlbox *b, HWND *hwndp, int has_help,
|
||||
HELPCTX(appearance_border),
|
||||
dlg_stdcheckbox_handler, I(offsetof(Config,sunken_edge)));
|
||||
|
||||
/*
|
||||
* Configurable font quality settings for Windows.
|
||||
*/
|
||||
s = ctrl_getset(b, "Window/Appearance", "font",
|
||||
"Font settings");
|
||||
ctrl_radiobuttons(s, "Font quality:", 'q', 2,
|
||||
HELPCTX(appearance_font),
|
||||
dlg_stdradiobutton_handler,
|
||||
I(offsetof(Config, font_quality)),
|
||||
"Antialiased", I(FQ_ANTIALIASED),
|
||||
"Non-Antialiased", I(FQ_NONANTIALIASED),
|
||||
"ClearType", I(FQ_CLEARTYPE),
|
||||
"Default", I(FQ_DEFAULT), NULL);
|
||||
|
||||
/*
|
||||
* Cyrillic Lock is a horrid misfeature even on Windows, and
|
||||
* the least we can do is ensure it never makes it to any other
|
||||
|
@ -1319,7 +1319,7 @@ static void init_fonts(int pick_width, int pick_height)
|
||||
#define f(i,c,w,u) \
|
||||
fonts[i] = CreateFont (font_height, font_width, 0, 0, w, FALSE, u, FALSE, \
|
||||
c, OUT_DEFAULT_PRECIS, \
|
||||
CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, \
|
||||
CLIP_DEFAULT_PRECIS, FONT_QUALITY(cfg.font_quality), \
|
||||
FIXED_PITCH | FF_DONTCARE, cfg.font.name)
|
||||
|
||||
f(FONT_NORMAL, cfg.font.charset, fw_dontcare, FALSE);
|
||||
@ -1488,7 +1488,7 @@ static void another_font(int fontno)
|
||||
fonts[fontno] =
|
||||
CreateFont(font_height * (1 + !!(fontno & FONT_HIGH)), x, 0, 0, w,
|
||||
FALSE, u, FALSE, c, OUT_DEFAULT_PRECIS,
|
||||
CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY,
|
||||
CLIP_DEFAULT_PRECIS, FONT_QUALITY(cfg.font_quality),
|
||||
FIXED_PITCH | FF_DONTCARE, s);
|
||||
|
||||
fontflag[fontno] = 1;
|
||||
@ -2142,6 +2142,7 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
|
||||
cfg.font.isbold != prev_cfg.font.isbold ||
|
||||
cfg.font.height != prev_cfg.font.height ||
|
||||
cfg.font.charset != prev_cfg.font.charset ||
|
||||
cfg.font_quality != prev_cfg.font_quality ||
|
||||
cfg.vtmode != prev_cfg.vtmode ||
|
||||
cfg.bold_colour != prev_cfg.bold_colour ||
|
||||
cfg.resize_action == RESIZE_DISABLED ||
|
||||
|
@ -27,8 +27,30 @@ struct FontSpec {
|
||||
int charset;
|
||||
};
|
||||
|
||||
#ifndef CLEARTYPE_QUALITY
|
||||
#define CLEARTYPE_QUALITY 5
|
||||
#endif
|
||||
#define FONT_QUALITY(fq) ( \
|
||||
(fq) == FQ_DEFAULT ? DEFAULT_QUALITY : \
|
||||
(fq) == FQ_ANTIALIASED ? ANTIALIASED_QUALITY : \
|
||||
(fq) == FQ_NONANTIALIASED ? NONANTIALIASED_QUALITY : \
|
||||
CLEARTYPE_QUALITY)
|
||||
|
||||
/* VC++ 6 doesn't have GetWindowLongPtr and friends. Degrade nicely. */
|
||||
|
||||
#ifndef GWLP_USERDATA
|
||||
#define GetWindowLongPtr GetWindowLong
|
||||
#define SetWindowLongPtr SetWindowLong
|
||||
#define GWLP_USERDATA GWL_USERDATA
|
||||
#define DWLP_MSGRESULT DWL_MSGRESULT
|
||||
#endif
|
||||
|
||||
#define BOXFLAGS DLGWINDOWEXTRA
|
||||
#ifdef LONG_PTR
|
||||
#define BOXRESULT (DLGWINDOWEXTRA + sizeof(LONG_PTR))
|
||||
#else
|
||||
#define BOXRESULT (DLGWINDOWEXTRA + 4)
|
||||
#endif
|
||||
#define DF_END 0x0001
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user