Text area font problem

BlitzPlus Forums/BlitzPlus Programming/Text area font problem

Rottbott(Posted 2004) [#1]
SetTextAreaFont FileEdit, RequestFont()


This doesn't work. Not matter which font I select, it always comes out as the standard Arial font or whatever it is. A bug in Blitz+?


WillKoh(Posted 2004) [#2]
About fonts; you know why many fonts get their chars "cropped" esp. cursive ones, and what could be done about it?


EOF(Posted 2004) [#3]
Seems ok here. Test program (using latest B+):
win=CreateWindow("Text Area - Font",50,150,407,184,Desktop(),1)
textarea = CreateTextArea(18,20,361,96,win,1)
bt_changefont=CreateButton("Change Font",120,128,124,20,win)
AddTextAreaText textarea,"Font test ABC123 !£$%^&*()"

Repeat
 ev=WaitEvent()
 Select ev
  Case $401 ; gadget
  If EventSource()=bt_changefont
   SetTextAreaFont textarea,RequestFont()
  EndIf
  Case $803,$103 ; close window / keystoke
   Exit
 End Select
Forever

End

How about:
fnt=RequestFont()
SetTextAreaFont textarea,fnt
??


Rottbott(Posted 2004) [#4]
WillKoh, not a clue!

Syntax Error, very interesting. That test program works. Now try adding these lines before setting the font:

   SetTextAreaColor textarea, 255, 255, 255
   SetTextAreaColor textarea, 0, 0, 0, True


Now it doesn't work any more!


Rottbott(Posted 2004) [#5]
Aha, my problem was actually two seperate problems.

1) Changing the text area font resets the foreground colour but not the background
2) You can't do LoadFont("Data\Blitz.fon", 14), you have to install the font and do LoadFont("Blitz", 14), or it will appear as Arial.


EOF(Posted 2004) [#6]
Regarding number 2. I believe Blitz looks at the fonts internal 'typeface' name rather than the filename.