mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-15 14:16:07 -06:00
CtrlLib, Draw: GetStdFontCyA returns height including bold/italic variants, ArrayCtrl/DropList are now using this to avoid DisplayPopup for AttrText().Bold() (on MacOS, Bold standard text has 1 more pixel than normal)
This commit is contained in:
parent
8fefb89735
commit
1f675b5c32
9 changed files with 38 additions and 6 deletions
|
|
@ -2808,7 +2808,7 @@ void ArrayCtrl::Reset() {
|
|||
acceptingrow = 0;
|
||||
columnsortfindkey = false;
|
||||
spanwidecells = false;
|
||||
linecy = Draw::GetStdFontCy();
|
||||
linecy = GetStdFontCyA();
|
||||
Clear();
|
||||
sb.SetLine(linecy);
|
||||
columnsortsecondary = NULL;
|
||||
|
|
|
|||
|
|
@ -123,6 +123,7 @@ void DisplayPopup::Pop::Set(Ctrl *_ctrl, const Rect& _item,
|
|||
{
|
||||
if(!GUI_ToolTips())
|
||||
return;
|
||||
|
||||
if(item != _item || ctrl != _ctrl || value != _value || display != _display || ink != _ink ||
|
||||
paper != _paper || style != _style) {
|
||||
item = _item;
|
||||
|
|
|
|||
|
|
@ -1886,10 +1886,10 @@ bool FileSel::Execute(int _mode) {
|
|||
for(int i = 0; i < lru.GetCount(); i++)
|
||||
if(IsFullPath(lru[i]) && filesystem->FolderExists(lru[i]))
|
||||
dir.Add(lru[i]);
|
||||
dir.SetDisplay(Single<FolderDisplay>(), max(16, Draw::GetStdFontCy()));
|
||||
dir.SetDisplay(Single<FolderDisplay>(), max(16, GetStdFontCyA()));
|
||||
}
|
||||
else {
|
||||
dir.SetDisplay(Single<HomeDisplay>(), max(16, Draw::GetStdFontCy()));
|
||||
dir.SetDisplay(Single<HomeDisplay>(), max(16, GetStdFontCyA()));
|
||||
if(filesystem->IsPosix()) {
|
||||
if(String(~dir)[0] == '/')
|
||||
dir <<= "";
|
||||
|
|
|
|||
|
|
@ -335,7 +335,7 @@ PopUpList::PopUpList() {
|
|||
droplines = 16;
|
||||
inpopup = 0;
|
||||
permanent = false;
|
||||
linecy = Draw::GetStdFontCy();
|
||||
linecy = GetStdFontCyA();
|
||||
display = &StdDisplay();
|
||||
convert = NULL;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -132,7 +132,7 @@ void PopUpTable::Normal()
|
|||
MouseMoveCursor();
|
||||
NoGrid();
|
||||
AutoHideSb();
|
||||
SetLineCy(Draw::GetStdFontCy());
|
||||
SetLineCy(GetStdFontCyA());
|
||||
// NoPopUpEx();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -62,6 +62,7 @@ class Font : public ValueType<Font, FONT_V, Moveable<Font> >{
|
|||
|
||||
static Font AStdFont;
|
||||
static Size StdFontSize;
|
||||
static Size StdFontSizeA; // max of normal / italic / bold / bold-italic
|
||||
static bool std_font_override;
|
||||
|
||||
static void SetStdFont0(Font font);
|
||||
|
|
@ -96,6 +97,7 @@ public:
|
|||
static void SetStdFont(Font font);
|
||||
static Font GetStdFont();
|
||||
static Size GetStdFontSize();
|
||||
static Size GetStdFontSizeA();
|
||||
|
||||
enum {
|
||||
STDFONT,
|
||||
|
|
@ -258,8 +260,10 @@ String AsString(const Font& f);
|
|||
|
||||
inline void SetStdFont(Font font) { Font::SetStdFont(font); }
|
||||
inline Font GetStdFont() { return Font::GetStdFont(); }
|
||||
inline Size GetStdFontSize() { return Font::GetStdFontSize(); } // deprecated
|
||||
inline Size GetStdFontSize() { return Font::GetStdFontSize(); }
|
||||
inline Size GetStdFontSizeA() { return Font::GetStdFontSizeA(); }
|
||||
inline int GetStdFontCy() { return GetStdFontSize().cy; }
|
||||
inline int GetStdFontCyA() { return GetStdFontSizeA().cy; }
|
||||
|
||||
Font StdFont();
|
||||
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ void Std(Font& font)
|
|||
}
|
||||
|
||||
Size Font::StdFontSize;
|
||||
Size Font::StdFontSizeA;
|
||||
Font Font::AStdFont;
|
||||
|
||||
INITBLOCK {
|
||||
|
|
@ -118,6 +119,15 @@ void Font::SyncStdFont()
|
|||
{
|
||||
Mutex::Lock __(sFontLock);
|
||||
StdFontSize = Size(AStdFont.GetAveWidth(), AStdFont().GetCy());
|
||||
|
||||
StdFontSizeA = Size(0, 0);
|
||||
for(int italic = 0; italic < 2; italic++)
|
||||
for(int bold = 0; bold < 2; bold++) {
|
||||
Font fnt = AStdFont().Bold(bold).Italic(italic);
|
||||
StdFontSizeA.cx = max(StdFontSizeA.cx, fnt.GetAveWidth());
|
||||
StdFontSizeA.cy = max(StdFontSizeA.cy, fnt.GetCy());
|
||||
}
|
||||
|
||||
LLOG("SyncStdFont " << StdFontSize);
|
||||
SyncUHDMode();
|
||||
}
|
||||
|
|
@ -186,6 +196,12 @@ Size Font::GetStdFontSize()
|
|||
return StdFontSize;
|
||||
}
|
||||
|
||||
Size Font::GetStdFontSizeA()
|
||||
{
|
||||
InitStdFont();
|
||||
return StdFontSizeA;
|
||||
}
|
||||
|
||||
Font StdFont()
|
||||
{
|
||||
return Font(0, -32000);
|
||||
|
|
|
|||
|
|
@ -27,6 +27,11 @@ and application rarely need to call this function.&]
|
|||
[s2;%% Returns the standard font height (in pixels or dots).&]
|
||||
[s3; &]
|
||||
[s4; &]
|
||||
[s5;:Upp`:`:GetStdFontCyA`(`): [@(0.0.255) int] [* GetStdFontCyA]()&]
|
||||
[s2;%% Returns the standard font height (in pixels or dots), including
|
||||
bold and italic variants (maximum is used).&]
|
||||
[s3; &]
|
||||
[s4; &]
|
||||
[s5;:Upp`:`:StdFont`(`): [_^Upp`:`:Font^ Font]_[* StdFont]()&]
|
||||
[s2;%% Same as GetStdFont().&]
|
||||
[s3; &]
|
||||
|
|
|
|||
|
|
@ -90,6 +90,12 @@ default setting.&]
|
|||
of glyphs.&]
|
||||
[s3; &]
|
||||
[s4; &]
|
||||
[s5;:Upp`:`:Font`:`:GetStdFontSizeA`(`): [@(0.0.255) static] Size [* GetStdFontSizeA]()&]
|
||||
[s2;%% Returns metrics of standard font `- height and average width
|
||||
of glyphs, including its bold and italic variants, using maximal
|
||||
value of variants.&]
|
||||
[s3; &]
|
||||
[s4; &]
|
||||
[s5;:Font`:`:GetFace`(`)const: [@(0.0.255) int]_[* GetFace]()_[@(0.0.255) const]&]
|
||||
[s2;%% Face index of Font.&]
|
||||
[s3; &]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue