TextField:setFont: Difference between revisions

From GiderosMobile
No edit summary
No edit summary
 
(8 intermediate revisions by 2 users not shown)
Line 1: Line 1:
__NOTOC__
__NOTOC__
'''Available since:''' Gideros 2016.08<br/>
'''Available since:''' Gideros 2016.08<br/>
'''Class:''' [[TextField]]<br/>
=== Description ===
=== Description ===
set font to use
Sets the Font to use.
<source lang="lua">
<syntaxhighlight lang="lua">
TextField:setFont(font)
TextField:setFont(font)
</source>
</syntaxhighlight>
 
'''note''': this works only if the TextField has already a font attached to it
 
=== Parameters ===
=== Parameters ===
'''font''': (FontBase) font to use <br/>
'''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}}

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)