Difference between revisions of "TTFont.new"
(removed language stuff) |
m (Text replacement - "<source" to "<syntaxhighlight") |
||
Line 5: | Line 5: | ||
=== Description === | === Description === | ||
Creates a new '''TTFont''' object. | Creates a new '''TTFont''' object. | ||
− | < | + | <syntaxhighlight lang="lua"> |
TTFont.new(filename,size,text,filtering,outlineSize) | TTFont.new(filename,size,text,filtering,outlineSize) | ||
</source> | </source> | ||
Line 22: | Line 22: | ||
Two forms are accepted: | Two forms are accepted: | ||
− | < | + | <syntaxhighlight lang="lua">{"font1.ttf","font2.ttf",..}</source> |
or | or | ||
− | < | + | <syntaxhighlight lang="lua">{{file="font1.ttf", sizeMult=1},{file="font2.ttf", sizeMult=1.1},...}</source> |
Characters will be looked up in each file in sequence until a glyph is found. | Characters will be looked up in each file in sequence until a glyph is found. | ||
{{TTFont}} | {{TTFont}} |
Revision as of 14:31, 13 July 2023
Available since: Gideros 2011.6
Class: TTFont
Description
Creates a new TTFont object. <syntaxhighlight lang="lua"> TTFont.new(filename,size,text,filtering,outlineSize) </source>
Parameters
filename: (string) the name of the TTF file to be loaded
size: (number) size of the font
text: (string, optional) if specified, TTFont caches the characters of specified text to speed up the rendering. If instead of specified symbols empty quotes "" are provided, then all font symbols are cached
filtering: (boolean, default = false) or (positive number, default = 0) whether or not the font texture is filtered optional
outlineSize: (number) if set, the font will be rendered with an outline of the given size optional
Starting from gideros 2017.9, 'text' optional parameter can be an empty string "", in which case Gideros will automatically cache characters as they are used.
Also, 2017.9 allows filename to be a table of several file names and associated size factor.
Two forms are accepted: <syntaxhighlight lang="lua">{"font1.ttf","font2.ttf",..}</source> or <syntaxhighlight lang="lua">{{file="font1.ttf", sizeMult=1},{file="font2.ttf", sizeMult=1.1},...}</source>
Characters will be looked up in each file in sequence until a glyph is found.