mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-08-15 14:22:57 -06:00
CtrlCore: Now reducing standard font size in unusual setups
This commit is contained in:
parent
6e6476e3df
commit
37e734041f
2 changed files with 18 additions and 0 deletions
|
|
@ -932,9 +932,23 @@ void Modality::End()
|
|||
}
|
||||
|
||||
extern void (*whenSetStdFont)();
|
||||
extern void (*adjustDefaultFont)(Font& font);
|
||||
|
||||
INITBLOCK {
|
||||
whenSetStdFont = &Ctrl::ReSkin;
|
||||
|
||||
adjustDefaultFont = [](Font& font) {
|
||||
Size wsz = Ctrl::GetPrimaryWorkArea().GetSize();
|
||||
wsz.cy = max(wsz.cy - DPI(24), 0);
|
||||
while(font.GetHeight() >= 0) {
|
||||
Size csz = GetTextSize(sZoomText, font);
|
||||
Size dsz = Size(99, 13 + 4);
|
||||
Size sz = csz * Size(1000, 700) / dsz;
|
||||
if(sz.cx <= wsz.cx && sz.cy <= wsz.cy)
|
||||
break;
|
||||
font.Height(font.GetHeight() - 1);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
void (**Ctrl::skin)();
|
||||
|
|
|
|||
|
|
@ -161,9 +161,13 @@ void Font::SetStdFont0(Font font)
|
|||
|
||||
bool Font::std_font_override;
|
||||
|
||||
void (*adjustDefaultFont)(Font& font);
|
||||
|
||||
void Font::SetDefaultFont(Font font)
|
||||
{
|
||||
LLOG("SetDefaultFont " << font);
|
||||
if(adjustDefaultFont)
|
||||
adjustDefaultFont(font);
|
||||
int override_scale = Atoi(GetEnv("UPP_SCALE__"));
|
||||
if(override_scale) {
|
||||
int cy = decode(override_scale, 3, 18, 4, 24, 6, 36, 12);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue