SetTextAreaFont - Problem
BlitzPlus Forums/BlitzPlus Programming/SetTextAreaFont - Problem
| ||
I have a problem with using SetTextAreaFont. I use this:font=RequestFont() If font>0 myfont$=FontName$(font) ;In this case "Arial" fonth=FontSize(font) ;In this case size 16 SetTextAreaFont textarea1,font EndIf This seems to work fine. I then save the font info. When I load it and use this: myfont$="Arial" fonth=16 fnt=LoadFont(myfont$,fonth) SetTextAreaFont textarea1,fnt The font appears much smaller. Not the size selected. If I use SetFont after LoadFont() B+ will crash (Invalid Blitz2D Handle). I think this is because I'm not initiating any Graphic modes. So If I have'nt lost you, I'm looking for help :) L8r, |
| ||
Test this small test app, on my computer I get bigger font:AppTitle("Test") win=CreateWindow("Test",100,100,300,300,Desktop()) are=CreateTextArea(10,10,250,150,win) but=CreateButton("Exit",10,200,40,16,win) myfont$="Arial" fonth=23 fnt=LoadFont(myfont$,fonth) SetTextAreaFont are,fnt SetTextAreaText(are,"Should be bigger.") Repeat Delay 10 Until WaitEvent()=$401 And EventSource()=but End Bye. |
| ||
Here is an expanded exaple of your example:;Textarea Font Size Bug test ;Run app. Select font (Change Font button), choose Arial 24 Normal. ;Text will appear in textarea with proper size. ;Compare to size of font (also Arial 24 Normal) using loadfont in text area below. mmmmmm:) AppTitle("Test") win=CreateWindow("Test",100,100,300,300,Desktop()) Global are=CreateTextArea(10,20,250,50,win) Global are1=CreateTextArea(10,90,250,50,win) Global but=CreateButton("Exit",10,200,40,16,win) Global but1=CreateButton("Change Font",10,2,80,16,win) myfont$="Arial" fonth=24 fnt=LoadFont(myfont$,fonth) SetTextAreaFont are1,fnt SetTextAreaText(are1,"Should be bigger.") While WaitEvent()<>$803 id=EventID() If id=$401 manage_event() EndIf Wend End Function manage_event() es=EventSource() If es=but Then End If es=but1 font=RequestFont() If font>0 SetTextAreaFont are,font EndIf SetTextAreaText are,"This looks right",0,20,1 EndIf End Function Click on the Change Font button and select Arial 24 Normal. It will insert and show text in the proper size (using font requestor). Compare this to the text in the text area below using LoadFont. Although it is the same size the font it is much smaller. Maybe some others could test to verify this bug. :) -edit- I'm adding 8pnts to font size as a work around. It makes it close, but still not right. L8r, |
| ||
Hello, I think you found a bug. It seems that LoadFont and RequestFont work different. I tested the fonts with the commands: Fontsize/FontStyle/FontName. They printed the same value on both fonts. But the view is different, strange!! Adding 8 seems to be the only thing you can do for now. To we see a fix for this. Bye. |
| ||
Yea, I'm sure it's a bug... Reported. L8r, |