Difference between revisions of "TTFont.new"

From GiderosMobile
(Created page with "__NOTOC__ '''Available since:''' Gideros 2011.6<br/> === Description === <br /> Creates a new `TTFont` object.<br /> <br /> Starting from gideros 2017.9, 'text' optional param...")
 
Line 10: Line 10:
 
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.
 
<source lang="lua">
 
<source lang="lua">
= TTFont.new(filenamesizetextfilteringoutlineSize,)
+
TTFont.new(filename,size,text,filtering,outlineSize)
 
</source>
 
</source>
'''filename:''' (string) The name of the TTF file to be loaded ''''''<br/>
+
'''filename''': (string) The name of the TTF file to be loaded ''''''<br/>
'''size:''' (number) size of the font ''''''<br/>
+
'''size''': (number) size of the font ''''''<br/>
'''text:''' (string, optional) if specified, TTFont caches the characters of specified text to speed up the rendering ''''''<br/>
+
'''text''': (string, optional) if specified, TTFont caches the characters of specified text to speed up the rendering ''''''<br/>
'''filtering:''' (boolean, default = false) Whether or not the font texture is filtered '''optional'''<br/>
+
'''filtering''': (boolean, default = false) Whether or not the font texture is filtered '''optional'''<br/>
'''outlineSize:''' (number) If set, the font will be rendered with an outline of the given size '''optional'''<br/>
+
'''outlineSize''': (number) If set, the font will be rendered with an outline of the given size '''optional'''<br/>

Revision as of 10:21, 23 August 2018

Available since: Gideros 2011.6

Description


Creates a new `TTFont` object.

Starting from gideros 2017.9, 'text' optional parameter can be the 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: {"font1.ttf","font2.ttf",..} or {{file="font1.ttf", sizeMult=1},{file="font2.ttf", sizeMult=1.1},...}. Characters will be looked up in each file in sequence until a glyph is found.

 TTFont.new(filename,size,text,filtering,outlineSize)

'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 '
filtering: (boolean, default = false) 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