Deleted
Deleted Member
Posts: 0
|
Fonts
Jul 10, 2017 17:50:48 GMT -6
Post by Deleted on Jul 10, 2017 17:50:48 GMT -6
I apologize for waisting your time, on what should be a simple matter, but I am having difficulties with True Type Fonts. Yes, I checked the RC Basic Manual, for the correct command structure. LoadFont(slot,filename$,size) but the manual did not have an example. I have tried a simple program to place text on the screen with three different ttf's (including the FreeMono.ttf that comes with RC) windowOpen(0,"Font Test", 0, 0, 640,480,0) window(0) CanvasOpen(0,640,480,0,0,640,480,1) hideMouse() Canvas(0)
LoadFont(1,"FreeMono.ttf",60)
setColor(rgb(255,255,0))
DrawText("TEST",100,100)
update() waitkey() Every time I try, all I get is a bank screen, and a "DrawTextError: Could not load font at 1" I realize that I may not have the screen setup properly, but that shouldn't effect the loading of the font. DrawText also does not have an example. I will attach all three fonts. Can you please tell me what it is that I am doing wrong? Again. My apologies. J fonts.zip (616 KB)
|
|
|
Fonts
Jul 10, 2017 19:07:31 GMT -6
Post by n00b on Jul 10, 2017 19:07:31 GMT -6
Your example works. The only thing I can think is that you don't have the fonts in the same directory as your program and you are loading the font from your programs current directory. If that is not the case then let me know.
|
|
Deleted
Deleted Member
Posts: 0
|
Fonts
Jul 10, 2017 23:10:38 GMT -6
Post by Deleted on Jul 10, 2017 23:10:38 GMT -6
Ok. Having the font(s) in the same directory (as the ide) fixed it. Many thanks for the idea. I probably would not have thought of that. I usually keep all my assets in a sub-folder. The game I am trying to convert, an sdlbasic snakes and ladders that I made, has all images; fonts and audio files in one folder. The main menu image was accessed without a fault but the fonts were not... Fonts in program directory. I'm going to have to remember that one... Many thanks.
J
|
|
|
Fonts
Jul 11, 2017 19:35:29 GMT -6
Post by n00b on Jul 11, 2017 19:35:29 GMT -6
You can keep your fonts and any other assets in any folder you want. In your example you did not reference any sub-folder so the runtime assumes that the file is in the current working directory which will be the directory where your *.cbc file is located when running the program from the ide.
|
|
Deleted
Deleted Member
Posts: 0
|
Fonts
Jul 11, 2017 23:57:49 GMT -6
Post by Deleted on Jul 11, 2017 23:57:49 GMT -6
I'm not surprised. I tend to forget more than I can remember. Decrepitude is a bit like that. lol Thanks for the advice. Much appreciated.
J
|
|