Load fonts on Ruby Shoes

90 views Asked by At

How would I go about loading a .ttf file on my Shoes app and set that as my default font?

Shoes version is 3.3.7

The documentation from http://shoesrb.com/manual/Built-in.html and http://shoesrb.com/manual/Styles.html mention font sections but dont mention an example of loading fonts.

Instead of installing the ttf file manually, I would like to know possible methods I could use to bundle and load it in Shoes (shy).

Something like below would be helpful.

font('./fontfile.ttf')

I would also like to avoid calling the font for each para individual ly. A workaround for that would be helpful too.

Sorry about this, I'm pretty new to programming.

1

There are 1 answers

0
anothermh On BEST ANSWER

You can do the following in Shoes3, for example:

font 'relative/path/to/fonts/Arial.ttf' unless Shoes::FONTS.include?('Arial')
Shoes.app do
  ...
end

This example exists in the Shoes3 source.