Load a font from file

Just starting out? Need help? Post your questions and find answers here.
munfraid
Posts: 104
Joined: Sat Mar 24, 2018 1:33 pm

Load a font from file

Post by munfraid »

In PB we have the nice "RegisterFontFile()" command to provide our own font. Does anybody know how this can be achieved in SpiderBasic?
the.weavster
Posts: 220
Joined: Sat Mar 01, 2014 3:02 pm

Re: Load a font from file

Post by the.weavster »

I haven't tested this but RSBasic has made an OpenLibrary() command that enables you to load your own css file.

Maybe you could create a test.css file containing something like this:

Code: Select all

@font-face {
  font-family: FontNotAwesome;
  src: url(font_file.otf);
}
...and then in SB:

Code: Select all

OpenLibrary("/css/test.css")
LoadFont(0,"FontNotAwesome",12)
munfraid
Posts: 104
Joined: Sat Mar 24, 2018 1:33 pm

Re: Load a font from file

Post by munfraid »

Just tried it and it works perfectly - thanks a lot, the.weavster! :)
And of course thanks to RSBasic for this cool procedure, I will use it a lot!
Post Reply