1
0
mirror of https://github.com/FunkyFr3sh/cnc-ddraw.git synced 2025-03-15 06:04:49 +01:00

allow to specify min size for anti-aliased fonts

This commit is contained in:
FunkyFr3sh 2023-09-16 01:11:03 +02:00
parent 2e22226caf
commit 5ebda1fec7
2 changed files with 13 additions and 5 deletions

View File

@ -367,7 +367,7 @@ static void cfg_create_ini()
"rgb555=false\n"
"no_dinput_hook=false\n"
"refresh_rate=0\n"
"non_anti_aliased_fonts=true\n"
"anti_aliased_fonts_min_size=13\n"
"custom_width=0\n"
"custom_height=0\n"
"min_font_size=0\n"

View File

@ -910,7 +910,15 @@ HFONT WINAPI fake_CreateFontIndirectA(CONST LOGFONTA* lplf)
LOGFONTA lf;
memcpy(&lf, lplf, sizeof(lf));
if (cfg_get_bool("non_anti_aliased_fonts", TRUE))
int minFontSize = cfg_get_int("min_font_size", 0);
if (lf.lfHeight < 0) {
lf.lfHeight = min(-minFontSize, lf.lfHeight);
}
else {
lf.lfHeight = max(minFontSize, lf.lfHeight);
}
if (cfg_get_int("anti_aliased_fonts_min_size", 13) > abs(lf.lfHeight))
lf.lfQuality = NONANTIALIASED_QUALITY;
return real_CreateFontIndirectA(&lf);
@ -932,9 +940,6 @@ HFONT WINAPI fake_CreateFontA(
DWORD fdwPitchAndFamily,
LPCTSTR lpszFace)
{
if (cfg_get_bool("non_anti_aliased_fonts", TRUE))
fdwQuality = NONANTIALIASED_QUALITY;
int minFontSize = cfg_get_int("min_font_size", 0);
if (nHeight < 0) {
nHeight = min(-minFontSize, nHeight);
@ -943,6 +948,9 @@ HFONT WINAPI fake_CreateFontA(
nHeight = max(minFontSize, nHeight);
}
if (cfg_get_int("anti_aliased_fonts_min_size", 13) > abs(nHeight))
fdwQuality = NONANTIALIASED_QUALITY;
return
real_CreateFontA(
nHeight,