Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Studio Chat / [SOLVED] Anyone else having issues with loading ttf or otf fonts ?

Author
Message
PHeMoX
7
Years of Service
User Offline
Joined: 9th Jan 2018
Location:
Posted: 7th Dec 2024 12:03
At the moment loading any fonts fails. It will display a default font somehow. Can anyone else confirm this is happening?

(version is Studio 2024.09.10)

Code is nothing out of the ordinary, not inside a function;

The author of this post has marked a post as an answer.

Go to answer

PHeMoX
7
Years of Service
User Offline
Joined: 9th Jan 2018
Location:
Posted: 7th Dec 2024 12:17
Oke, I consider the above a bug, because the following does work (not related to filename):

SFSW
22
Years of Service
User Offline
Joined: 9th Oct 2002
Location:
Posted: 7th Dec 2024 16:54
I've run into problems trying to load installed fonts (from the Windows\Fonts folder) by both title and filename. Placing the TTF file in the \media folder and then loading from there by filename tends to work.
Virtual Nomad
Moderator
19
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 7th Dec 2024 18:20 Edited at: 7th Dec 2024 18:30
This post has been marked by the post author as the answer.
in your first example, you're not setting font1 to anything after declaring it so font1 = 0 which, when SetTextFont() sees it, will properly prompt AppGameKit to use the default font.

in your second example, you're letting AppGameKit assign the ID (which won't be 0).

IMHO, LoadFont(0...) should error out. maybe it is? which error mode are you using?

ie, 0 shouldnt be a valid parameter value? if anything, it could be another way to set the Default font but i don't like that either, so...
PHeMoX
7
Years of Service
User Offline
Joined: 9th Jan 2018
Location:
Posted: 7th Dec 2024 20:39 Edited at: 7th Dec 2024 20:45
Yeah, it only errors out when run on mobile itself (when closing the app by the way) and doesn't always seem to give an error. It will still default to just the default font, so it produces more like a warning than an error (unfortunately). I do agree that in my first example code I didn't explicitly assign it an ID integer myself, however for other file loading actions such code would usually still work without problems (albeit not 'clean' perhaps). I will change that for image loading stuff too. Maybe it does produces some problems too, just nothing that crashes or stops anything.

@SFSW: Ah yeah thanks, but these font files are in the media folder when trying this.
SFSW
22
Years of Service
User Offline
Joined: 9th Oct 2002
Location:
Posted: 8th Dec 2024 19:27 Edited at: 9th Dec 2024 00:50
Ah ok, yes that does remind me of similar behavior, some fonts just seem incompatible. There were a few I could just not get to load and I wasn't able to determine what was different about them that would cause the failure. Seemed to be intermittent and unpredictable. So I've gone with the bitmap font route ever since and never mess with font files.
Zappo
Valued Member
20
Years of Service
User Offline
Joined: 27th Oct 2004
Location: In the post
Posted: 10th Dec 2024 01:40
Unfortunately you are using the LoadFont command incorrectly in your first example. You can either pass it an ID (number) to load the font into, or you can have it choose the next available ID itself and return it for your variable. So you must use:
font1 = LoadFont("Munro.ttf")
This isn't a bug.
PHeMoX
7
Years of Service
User Offline
Joined: 9th Jan 2018
Location:
Posted: 19th Dec 2024 12:38
Oh I agree. Perhaps it should give an error or warning though.

Login to post a reply

Server time is: 2025-05-08 22:26:23
Your offset time is: 2025-05-08 22:26:23