ich möchte den Standard-Gadget-Font ändern und hierbei die maximale Schriftgröße ermitteln die noch als Buttonbeschriftung lesbar ist. Soweit kein Problem (Source #1). Hier wurde eine statische Font-Nummer verwendet.
Jetzt habe ich das auf dynamische Font-Nummern geändert (#PB_Any) und jetzt schlägt TextHeight fehlt - gibt bei jeder Schriftgröße immer 16 zurück. (Source #2).
Könnte da bitte mal jemand mit drüber schauen, bin gerade am Verzweifeln.
Ist das ein BUG? oder bin ich nur zu bl*de?
PB 5.31 beta 1 (x86) auf Win7 Prof. 64 Bit. Kann leider gerade nicht auf anderen PB-Versionen testen.
Danke.
NicknameFJ
Source #1
Code: Alles auswählen
EnableExplicit
Define Win, Schrift, Hoehe
Win = OpenWindow(#PB_Any,0,0,100,100,"",#PB_Window_Invisible)
If Win
Schrift = 30
Repeat
LoadFont(99,"MS Sans Serif",Schrift)
StartDrawing(WindowOutput(Win))
DrawingFont(FontID(99))
Hoehe = TextHeight("Beschriftung")
StopDrawing()
Schrift -1
Until Hoehe <= 14 Or Schrift < 1
CloseWindow(Win)
SetGadgetFont(#PB_Default,FontID(99))
EndIf
If Schrift
Debug "eingestellt auf MS Sans Serif: "+ Schrift
Debug "Fonthöhe: " + Hoehe
EndIf
Source #2
Code: Alles auswählen
EnableExplicit
Define Win, Schrift, Hoehe, GadgetFont
Win = OpenWindow(#PB_Any,0,0,100,100,"",#PB_Window_Invisible)
If Win
Schrift = 30
Repeat
If GadgetFont
FreeFont(GadgetFont)
EndIf
GadgetFont = LoadFont(#PB_Any,"MS Sans Serif",Schrift)
StartDrawing(WindowOutput(Win))
DrawingFont(GadgetFont)
Hoehe = TextHeight("Beschriftung")
StopDrawing()
Schrift -1
Until Hoehe <= 14 Or Schrift < 1
CloseWindow(Win)
SetGadgetFont(#PB_Default,GadgetFont)
EndIf
If Schrift
Debug "eingestellt auf MS Sans Serif: "+ Schrift
Debug "Fonthöhe: " + Hoehe
EndIf