Page 1 of 1

Load a font from file

Posted: Fri Jun 21, 2019 10:41 am
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?

Re: Load a font from file

Posted: Sun Jun 23, 2019 3:19 pm
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)

Re: Load a font from file

Posted: Mon Jun 24, 2019 9:53 am
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!