[Gambas-user] Sdl Font
T Lee Davidson
t.lee.davidson at gmail.com
Mon Jan 7 19:26:27 CET 2019
As I understand that, Fabien, "Font!MyFont" would be alternate syntax to "Font["MyFont"]. I have tried both ways and still get
error, "Incorrect font size".
Another look at the code clued me in to how the font name should be specified, ie. with a font size: Font["MyFont,16"]
I have been testing with the SDL application that is created by the IDE via the "New project..." dialog.
To Main(), I added: Font.Load("/usr/share/fonts/truetype/DejaVuSans.ttf")
And in differing locations within the Window_Draw() event, I added: Draw.Font = Font["DejaVuSans,16"]
The application now SegFaults.
___
Lee
On 1/7/19 1:29 AM, Fabien Bodard wrote:
>
> Font.Load (fontpath, "MyFont")
>
> Draw.Font = Font!MyFont
>
> Print Draw.Font.Size
>
>
> ... if I understand well Font act like Picture
>
> Le lun. 7 janv. 2019 00:58, T Lee Davidson <t.lee.davidson at gmail.com <mailto:t.lee.davidson at gmail.com>> a écrit :
>
> According to the wiki, Font acts like a read-only static array. And, according to [0], we should be able to use ...
>
> [Code]
> Dim hFont As Font
> hFont = Font[Null]
> [/Code]
>
> ... to have the default font returned.
>
> But, when I do that (even with the name of a TTF font I've loaded), I get, "Incorrect font size".
>
> The Font methods aren't exposed unless a variable is declared as type Font.
> But then if I try, "Print hFont.Name", I get, "Null object".
>
> Honestly, I don't know how Font is supposed to be used.
>
>
> ___
> Lee
>
> [0] http://gambaswiki.org/wiki/comp/gb.sdl2/font/_get
> P.S. Try to ensure you "Reply to List".
>
>
> On 1/5/19 10:10 PM, Shane wrote:
> > yes that is how i have tried to use it but the font doesn't change so it seems there might be a bug can someone else give
> this a try
> >
> > cheers Shane
>
>
> ----[ Gambas mailing-list is hosted by https://www.hostsharing.net ]----
>
>
>
> ----[ Gambas mailing-list is hosted by https://www.hostsharing.net ]----
>
More information about the User
mailing list