Re: [Gambas-user] gb3: changing the active font
- Original Message - >Nice, that actually works.> > >What's odd is that after some period of time it still halts with the >error "gb.sdl error: Couldn't open >/usr/local/share/gambas3/gb.sdl/DejaVuSans.ttf in Render 834". I checked >the value of Draw.Font after the crash and it reports the Name property >as being "DejaVuSans.ttf", even though I've only been setting it to >"Avatar.ttf". I changed the line to this: > >If Draw.Font.Name <> "Avatar.ttf" Then Draw.Font = >Draw.Font.Load("/home/kevinfishburne/Desktop/Sanctimonia, >Server/Images/Font/Avatar.ttf") > >and it still crashes. Somehow Draw.Font.Name is being reset to >"DejaVuSans.ttf". I searched the entire project for "Draw.Font" and >nothing else is modifying it. Sounds like a bug. I'm using revision 4229. - Hmm. I've found that I encounter the same "DejaVuSans.ttf" error even when trying to simply run the included StarField example. I even looked through the code and didn't find one reference to 'font' anywhere in the project. I am just starting out on learning gambas so I wrote it off at first, but after reading the discussion here I thought I would at least mention my findings. Hope that it is helpful in some way to track down what is happening. -- RSA(R) Conference 2012 Save $700 by Nov 18 Register now http://p.sf.net/sfu/rsa-sfdev2dev1 ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] gb3: changing the active font
On 11/03/2011 03:21 PM, Laurent Carlier wrote: > Le jeudi 3 novembre 2011 15:06:22, Kevin Fishburne a écrit : >> On 11/03/2011 01:14 AM, Fabien Bodard wrote: >>> Have you tried : >>> >>> Draw.Font = Draw.Font.Load("/home/kevinfishburne/Desktop/Sanctimonia, >>> >>> because draw.font.load normally not assignate a font to draw.font but >>> just return an object handle to a font object >> Nice, that actually works. >> >> What's odd is that after some period of time it still halts with the >> error "gb.sdl error: Couldn't open >> /usr/local/share/gambas3/gb.sdl/DejaVuSans.ttf in Render 834". I checked >> the value of Draw.Font after the crash and it reports the Name property >> as being "DejaVuSans.ttf", even though I've only been setting it to >> "Avatar.ttf". I changed the line to this: >> >> If Draw.Font.Name<> "Avatar.ttf" Then Draw.Font = >> Draw.Font.Load("/home/kevinfishburne/Desktop/Sanctimonia, >> Server/Images/Font/Avatar.ttf") >> >> and it still crashes. Somehow Draw.Font.Name is being reset to >> "DejaVuSans.ttf". I searched the entire project for "Draw.Font" and >> nothing else is modifying it. Sounds like a bug. I'm using revision 4229. > Sorry for the late reply but i've totaly missed it > > Font class act partially like qt's or gtk's one; you cannot use system fonts. > > > ---8< > > Public Sub FooMethod() > >DIM myfont AS FONT > >myFont = Font.Load("/path/to/my/font.ttf") >Font.Size = 20 >Font.Bold = True > >Draw.Begin(screen) > Draw.Font = myFont > blablabla >Draw.End() > > --->8 Fantastic! That works like a champion. Fonts in SDL are a bit tricky I see. Thanks everyone for your help. -- Kevin Fishburne Eight Virtues www: http://sales.eightvirtues.com e-mail: sa...@eightvirtues.com phone: (770) 853-6271 -- RSA(R) Conference 2012 Save $700 by Nov 18 Register now http://p.sf.net/sfu/rsa-sfdev2dev1 ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] gb3: changing the active font
Le jeudi 3 novembre 2011 15:06:22, Kevin Fishburne a écrit : > On 11/03/2011 01:14 AM, Fabien Bodard wrote: > > Have you tried : > > > > Draw.Font = Draw.Font.Load("/home/kevinfishburne/Desktop/Sanctimonia, > > > > because draw.font.load normally not assignate a font to draw.font but > > just return an object handle to a font object > > Nice, that actually works. > > What's odd is that after some period of time it still halts with the > error "gb.sdl error: Couldn't open > /usr/local/share/gambas3/gb.sdl/DejaVuSans.ttf in Render 834". I checked > the value of Draw.Font after the crash and it reports the Name property > as being "DejaVuSans.ttf", even though I've only been setting it to > "Avatar.ttf". I changed the line to this: > > If Draw.Font.Name <> "Avatar.ttf" Then Draw.Font = > Draw.Font.Load("/home/kevinfishburne/Desktop/Sanctimonia, > Server/Images/Font/Avatar.ttf") > > and it still crashes. Somehow Draw.Font.Name is being reset to > "DejaVuSans.ttf". I searched the entire project for "Draw.Font" and > nothing else is modifying it. Sounds like a bug. I'm using revision 4229. Sorry for the late reply but i've totaly missed it Font class act partially like qt's or gtk's one; you cannot use system fonts. ---8< Public Sub FooMethod() DIM myfont AS FONT myFont = Font.Load("/path/to/my/font.ttf") Font.Size = 20 Font.Bold = True Draw.Begin(screen) Draw.Font = myFont blablabla Draw.End() --->8 Regards -- RSA(R) Conference 2012 Save $700 by Nov 18 Register now http://p.sf.net/sfu/rsa-sfdev2dev1 ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] gb3: changing the active font
On 11/03/2011 01:14 AM, Fabien Bodard wrote: > Have you tried : > > Draw.Font = Draw.Font.Load("/home/kevinfishburne/Desktop/Sanctimonia, > > because draw.font.load normally not assignate a font to draw.font but > just return an object handle to a font object > Nice, that actually works. What's odd is that after some period of time it still halts with the error "gb.sdl error: Couldn't open /usr/local/share/gambas3/gb.sdl/DejaVuSans.ttf in Render 834". I checked the value of Draw.Font after the crash and it reports the Name property as being "DejaVuSans.ttf", even though I've only been setting it to "Avatar.ttf". I changed the line to this: If Draw.Font.Name <> "Avatar.ttf" Then Draw.Font = Draw.Font.Load("/home/kevinfishburne/Desktop/Sanctimonia, Server/Images/Font/Avatar.ttf") and it still crashes. Somehow Draw.Font.Name is being reset to "DejaVuSans.ttf". I searched the entire project for "Draw.Font" and nothing else is modifying it. Sounds like a bug. I'm using revision 4229. -- Kevin Fishburne Eight Virtues www: http://sales.eightvirtues.com e-mail: sa...@eightvirtues.com phone: (770) 853-6271 -- RSA(R) Conference 2012 Save $700 by Nov 18 Register now http://p.sf.net/sfu/rsa-sfdev2dev1 ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] gb3: changing the active font
Have you tried : Draw.Font = Draw.Font.Load("/home/kevinfishburne/Desktop/Sanctimonia, because draw.font.load normally not assignate a font to draw.font but just return an object handle to a font object > Server/Images/Font/Avatar.ttf") 2011/11/3 Kevin Fishburne : > 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:sa...@eightvirtues.com > phone: (770) 853-6271 > > > -- > RSA(R) Conference 2012 > Save $700 by Nov 18 > Register now > http://p.sf.net/sfu/rsa-sfdev2dev1 > ___ > Gambas-user mailing list > Gambas-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-user > -- Fabien Bodard -- RSA(R) Conference 2012 Save $700 by Nov 18 Register now http://p.sf.net/sfu/rsa-sfdev2dev1 ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] gb3: changing the active font
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:sa...@eightvirtues.com phone: (770) 853-6271 -- RSA(R) Conference 2012 Save $700 by Nov 18 Register now http://p.sf.net/sfu/rsa-sfdev2dev1 ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] gb3: changing the active font
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. -- RSA® Conference 2012 Save $700 by Nov 18 Register now! http://p.sf.net/sfu/rsa-sfdev2dev1 ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] gb3: changing the active font
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: sa...@eightvirtues.com phone: (770) 853-6271 -- RSA® Conference 2012 Save $700 by Nov 18 Register now! http://p.sf.net/sfu/rsa-sfdev2dev1 ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] gb3: changing the active font
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"] Bruce -- RSA® Conference 2012 Save $700 by Nov 18 Register now! http://p.sf.net/sfu/rsa-sfdev2dev1 ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
[Gambas-user] gb3: changing the active font
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. -- Kevin Fishburne Eight Virtues www: http://sales.eightvirtues.com e-mail: sa...@eightvirtues.com phone: (770) 853-6271 -- RSA® Conference 2012 Save $700 by Nov 18 Register now! http://p.sf.net/sfu/rsa-sfdev2dev1 ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user