[Gambas-user] gb3: changing the active font

Kevin Fishburne kevinfishburne at ...1887...
Wed Nov 2 06:47:05 CET 2011


On 11/02/2011 01:24 AM, Bruce Bruen wrote:
> On Wed, 2011-11-02 at 00:47 -0400, Kevin Fishburne wrote:
>
>> I'm looking through the docs trying to find out how to change the active
>> font but am not having much luck. Anyone know how to do it? I can change
>> the size and color, but not the font being used.
>>
>
> The active font of a what?
>
> To set the font via code for a text control in a form use the following
> as examples
>
>      MyControl.Font = Font["Bitstream Vera Serif,Bold,10"]
> or even
>      MyControl.Font=Font["Monospace,Bold,Italic,Underline,Strikeout,+4"]
>

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?

-- 
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