[Gambas-user] gb3: changing the active font

Kevin Fishburne kevinfishburne at ...1887...
Thu Nov 3 05:20:44 CET 2011


On 11/02/2011 02:54 AM, Bruce Bruen wrote:
> On Wed, 2011-11-02 at 01:47 -0400, Kevin Fishburne wrote:
>
>> I'm using SDL and OpenGL. Normal routines for drawing fonts in a
>> DrawingArea work fine; I didn't have to change my code after
>> switching
>> from GTK/Qt. This code works:
>>
>>     ' Draw dialogue buffer.
>>     Draw.Font.Size = sheight / 32
>>     Draw.Foreground = Color.Black
>>     Draw.Text(Client.Dialogue, 31, sheight - 15 - sheight / 32)
>>     Draw.Foreground = Color.Yellow
>>     Draw.Text(Client.Dialogue, 32, sheight - 16 - sheight / 32)
>>
>> So there is no control, just a draw event procedure "Screen_Draw" and
>> whatever procedures I call inside it. Maybe I should do "Font =
>> Font["..."] inside the procedure?
>
> You've still got me confused Kevin. DrawingArea is a control and has a
> Font property.  I know little of OpenGL or SDL but it looks like the SDL
> Draw class has an undocumented Font property so I'd still give the
> previous a go and hope.

With a DrawingArea you'd have a block like this:

Draw.Begin(DrawingArea)
   Draw.Font.Size = 10
   Draw.Text(...)
Draw.End

With SDL/OpenGL you have a procedure that is the draw event:

Public Sub Screen_Draw()

   Draw.Font.Size = 10
   Draw.Text(...)

End

The SDL draw event procedure seems to behave the same way as a 
Draw.Begin ... Draw.End block. I tried this:

Draw.Font.Load("/home/kevinfishburne/Desktop/Sanctimonia, 
Server/Images/Font/Avatar.ttf")

It doesn't throw an error, but doesn't change the font either. At some 
point after that for no apparent reason it then throws the error "gb.sdl 
error: Couldn't open /usr/local/share/gambas3/gb.sdl/DejaVuSans.ttf in 
Render 834". If I use just "Font.Load("...")" it exhibits the same 
behavior but the error message reflects the Avatar.ttf font instead of 
DejaVuSans. Weird.


-- 
Kevin Fishburne
Eight Virtues
www:http://sales.eightvirtues.com
e-mail:sales at ...1887...
phone: (770) 853-6271





More information about the User mailing list