TextField:setFont: Difference between revisions

From GiderosMobile
m Text replacement - "<source" to "<syntaxhighlight"
No edit summary
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
__NOTOC__
__NOTOC__
<languages />
'''Available since:''' Gideros 2016.08<br/>
'''<translate>Available since</translate>:''' Gideros 2016.08<br/>
'''Class:''' [[TextField]]<br/>
'''<translate>Class</translate>:''' [[Special:MyLanguage/TextField|TextField]]<br/>
 
=== <translate>Description</translate> ===
=== Description ===
<translate>set font to use</translate>
Sets the Font to use.
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
TextField:setFont(font)
TextField:setFont(font)
</source>
</syntaxhighlight>
=== <translate>Parameters</translate> ===
 
'''font''': (FontBase) <translate>font to use</translate> <br/>
'''note''': this works only if the TextField has already a font attached to it
 
=== Parameters ===
'''font''': (FontBase) font to use<br/>
 
=== Example ===
<syntaxhighlight lang="lua">
local font = TTFont.new("fonts/Tahoma.ttf", 32, "", true, 1)
local font2 = TTFont.new("fonts/TahomaBold.ttf", 28, "", true, 1)
local text = TextField.new(font, "This is a text")
text:setFont(font2)
text:setPosition(100, 100)
stage:addChild(text)
</syntaxhighlight>


{{TextField}}
{{TextField}}

Latest revision as of 14:28, 8 October 2026

Available since: Gideros 2016.08
Class: TextField

Description

Sets the Font to use.

TextField:setFont(font)
note: this works only if the TextField has already a font attached to it

Parameters

font: (FontBase) font to use

Example

local font = TTFont.new("fonts/Tahoma.ttf", 32, "", true, 1)
local font2 = TTFont.new("fonts/TahomaBold.ttf", 28, "", true, 1)
local text = TextField.new(font, "This is a text")
text:setFont(font2)
text:setPosition(100, 100)
stage:addChild(text)