How to render fonts at full screen size?
Hello,
I would like to have a window that can be sized basically full screen and shows a integer number.
The application is to optimize an intensity in the lab, where the screen display should be one helper to achieve maximum intensity setting.
Now the experiment is not necessarily close to the computer, so it would be suitable if the intensity display can be resized to full screen area.
So I wrote a resize event handler that scales the font according to the panel size:
Window CountsView() : Panel
PauseUpdate; Silent 1 // building window...
NewPanel /K=1 /W=(62,1227,546,1317) as "Counts"
TitleBox title_Counts,pos={0.00,0.00},size={484.00,90.00},title="123456789"
TitleBox title_Counts,font="Courier New",fSize=72,frame=0,fStyle=1
TitleBox title_Counts,anchor= MC,fixedSize=1
SetWindow kwTopWin,hook(resize)=ResizeCountViewWindowHook
EndMacro
Function ResizeCountViewWindowHook(s)
STRUCT WMWinHookStruct &s
variable fSize
variable xSize, ySize, r, g, b
variable rb, gb ,bb
switch(s.eventCode)
case EVENT_RESIZE_WINDOW_HOOK:
GetWindow $s.winName, wsizeDC
xSize = V_right - V_left
ySize = V_Bottom - V_top
fSize = ySize > IGOR_MAX_FONTSIZE ? IGOR_MAX_FONTSIZE : ySize
ControlInfo/W=$s.winName title_counts
r = V_Red
g = V_Green
b = V_Blue
ControlInfo/W=$s.winName kwBackgroundColor
rb = V_Red
gb = V_Green
bb = V_Blue
do
TitleBox title_Counts, win=$s.winName, pos={0, 0}, fixedSize=0, fColor=(rb, gb ,bb), fSize=fSize
ControlUpdate/W=$s.winName title_Counts
ControlInfo/W=$s.winName title_counts
fSize--
while(V_right-V_left > xSize && fSize)
fSize++
TitleBox title_Counts, win=$s.winName, pos={0, 0}, fixedSize=1, fColor=(r, g ,b), size={xSize, ySize}, fSize=fSize
return 0
endswitch
return 0
End
So I ran into the problem that the maximum font size that can be used is limited to 100 when using fSize and to 99 when using the "\Zxx" syntax.
On a typical display this is for 9 digits like "123456789" a size in x direction of 540 pixels. So on FHD it is about 1/3.5 of the screen size and on UHD about 1/6 of the screen size.
(Windows 100% GUI scaling)
I tried also Igor Tex but could not find a working tag to set the font size.
Of course I could change it to render each digit as graph or filled poly, which would be scalable, but going this way seems a bit over the edge for such simple problem. Also it would hit the performance.
So is there another way to render text in a full screen size?
(Is there a reason to limit the allowed font size to 99?)
Another point in the code example above is the determination of the size of font in the TitleBox if a text would be rendered with a certain font size. It seems I have to actually render it calling ControlUpdate to be able to read the size back, to decide if I require to reduce the font size.
It would be better to be able to do that somehow virtually without actually rendering it to the user visible GUI.
Best regards,
Michael Huth
Hi,
One idea is to use graph expansion to scale the image. As an example I used the phrase "test" in an annotation box (I know very clever choice of words) and 96 font apparently font sizing via /Z can handle on 2 digits.
Then I used the graph expansion function to enlarge and now the text fills my entire screen (13" lap top)
Andy
May 11, 2020 at 12:43 pm - Permalink