I tried (and I'm just playing around here):
Code: Select all
Local fontSize = GetAttribute(#DISPLAY, 1, #ATTRHEIGHT / 10)
DebugPrint(fontSize)Any tips?
Thanks!
Code: Select all
Local fontSize = GetAttribute(#DISPLAY, 1, #ATTRHEIGHT / 10)
DebugPrint(fontSize)Code: Select all
Local fontSize = GetAttribute(#DISPLAY, 1, #ATTRHEIGHT) / 10
DebugPrint(fontSize)Can I blame the heat on this one?... Please?jPV wrote: ↑Tue Jul 15, 2025 7:51 pm You have the division in the wrong place. You should first query the height attribute with the GetAttribute(), and then divide it. If multiplying does work in the wrong way, you are probably getting some unintented value by luck.
So, like this:Code: Select all
Local fontSize = GetAttribute(#DISPLAY, 1, #ATTRHEIGHT) / 10 DebugPrint(fontSize)
If it came across as me calling anyone but myself and the initial idea "dumb" then I am truly sorry. That was not at all what I meant. Forgive me if that's the case.
Code: Select all
Const #MAXFONTSIZEFACTOR=0.15
Function p_AdaptToWindow()
p_RemoveAllMessages(0)
gDisplayHeight=GetAttribute(#DISPLAY, gLRCdisplay, #ATTRHEIGHT)
gDisplayWidth=GetAttribute(#DISPLAY, gLRCdisplay, #ATTRWIDTH)
gRightBorder=GetAttribute(#DISPLAY, gLRCdisplay, #ATTRBORDERRIGHT)
If gDisplayHeight<10 Then Return ; wenn zu klein, hat das keinen Sinn mehr
; Faktor für Schriftgrößenveränderung ermitteln
Local FontSizeFactor=Min(gDisplayHeight/ToNumber(gConfig["DisplayHeight"]),gDisplayWidth/ToNumber(gConfig["DisplayWidth"]))
Local maxFSize=Limit(gDisplayHeight*#MAXFONTSIZEFACTOR,1,1e9) ; maxFSize ist der Maximalwert
; neue Schriftgrößen festlegen
gLRCFontSize=Limit(FontSizeFactor*ToNumber(gConfig["LRCFontSize"]),1,maxFSize)
gTxtFontSize=Limit(FontSizeFactor*ToNumber(gConfig["TxtFontSize"]),1,maxFSize)
gTagFontSize=Limit(FontSizeFactor*ToNumber(gConfig["TagFontSize"]),1,maxFSize)
gMsgFontSize=Limit(FontSizeFactor*ToNumber(gConfig["MsgFontSize"]),1,maxFSize)