Difference between revisions of "TTFont.new"

From GiderosMobile
(formatting)
(3 intermediate revisions by 2 users not shown)
Line 3: Line 3:
 
'''<translate>Available since</translate>:''' Gideros 2011.6<br/>
 
'''<translate>Available since</translate>:''' Gideros 2011.6<br/>
 
'''<translate>Class</translate>:''' [[Special:MyLanguage/TTFont|TTFont]]<br/>
 
'''<translate>Class</translate>:''' [[Special:MyLanguage/TTFont|TTFont]]<br/>
 +
 
=== <translate>Description</translate> ===
 
=== <translate>Description</translate> ===
<translate><br />
+
Creates a new [[Special:MyLanguage/TTFont|TTFont]] object.
Creates a new [[Special:MyLanguage/TTFont|TTFont]] object.<br />
 
<br />
 
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.
 
<br /><br />
 
 
 
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.</translate>
 
 
<source lang="lua">
 
<source lang="lua">
TTFont.new(filename,size,text,filtering,outlineSize)
+
TTFont.new(filename,size,text,filtering,outlineSize)
 
</source>
 
</source>
 +
 
=== <translate>Parameters</translate> ===
 
=== <translate>Parameters</translate> ===
 
'''filename''': (string) <translate>The name of the TTF file to be loaded</translate> <br/>
 
'''filename''': (string) <translate>The name of the TTF file to be loaded</translate> <br/>
 
'''size''': (number) <translate>size of the font</translate> <br/>
 
'''size''': (number) <translate>size of the font</translate> <br/>
 
'''text''': (string, optional) <translate>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.</translate> <br/>
 
'''text''': (string, optional) <translate>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.</translate> <br/>
'''filtering''': (boolean, default = false) <translate>Whether or not the font texture is filtered</translate> '''optional'''<br/>
+
'''filtering''': (boolean, default = false) or (positive number, default = 0) <translate>Whether or not the font texture is filtered</translate> '''optional'''<br/>
 
'''outlineSize''': (number) <translate>If set, the font will be rendered with an outline of the given size</translate> '''optional'''<br/>
 
'''outlineSize''': (number) <translate>If set, the font will be rendered with an outline of the given size</translate> '''optional'''<br/>
 +
 +
 +
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:
 +
<source lang="lua">{"font1.ttf","font2.ttf",..}</source>
 +
or
 +
<source 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.
 +
 +
{{TTFont}}

Revision as of 16:12, 10 December 2019


Available since: Gideros 2011.6
Class: TTFont

Description

Creates a new TTFont object.

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

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:

{"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.