A class which represents font. This is immutable.
When you render text on Texture, you have to pass instance of Font to specify font of the text.
TTF and TTC files can be used.
Font names which can be used as arguments are as below:
- File name, Path(extension can be omitted.)
- Fonts which are already installed(Windows)
- "(font name)" or "(font name), (style name)" (Linux/Mac OS X)
- (ex1: FreeSans
- (ex2: FreeSans, Bold
It is recommended to specify font-style for Linux/Mac OS X
Class methods
Font.new(path_or_name, size, options = {})-
Pass the path of a font file or font name to generate
Fontinstance.You have to pass. Keys and values below can be selected.Hashas optionsKey Value Default :boldBold or not false:italicItalic or not false:ttc_indexIndex of TTC file 0 :ttc_indexis valid only when you specify TTC file path inpath_or_name. Font.exist?(path_or_name)-
If font name or font path of a font file exists, return
true, otherwise returnfalse.
Instance Methods
bold?-
If font is bold, return true, otherwise return false .
dispose-
Recommended not to use after Ver 0.1.13.
(After Ver 0.1.13) Don't do anything.
(Before Ver 0.1.12) Release Font resource
disposed?-
Recommended not to use after Ver 0.1.13.
(After Ver 0.1.13) Always return
false(Before Ver 0.1.12) If the resource has been disposed by
disposealready, returntrueotherwise returnfalse get_size(text)-
Get array of size of text when render
text([(Width), (Height)]). italic?-
When the font is Italic, return
true, otherwise returnfalse name-
Get font name.
size-
Get the height of the font.