Difference between revisions of "CompositeFont"
From GiderosMobile
m (made it more clear to use curly braces) |
|||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
− | |||
<!-- GIDEROSOBJ:CompositeFont --> | <!-- GIDEROSOBJ:CompositeFont --> | ||
− | ''' | + | '''Supported platforms:''' [[File:Platform android.png]][[File:Platform ios.png]][[File:Platform mac.png]][[File:Platform pc.png]][[File:Platform html5.png]][[File:Platform winrt.png]][[File:Platform win32.png]]<br/> |
− | ''' | + | '''Available since:''' Gideros 2019.1<br/> |
− | ''' | + | '''Inherits from:''' [[Special:MyLanguage/FontBase|FontBase]]<br/> |
− | === | + | === Description === |
The CompositeFont class is used to define fonts composed from other fonts. It allows to mix a regular font with an outlined font to create bordered font, and possibly more effects. | The CompositeFont class is used to define fonts composed from other fonts. It allows to mix a regular font with an outlined font to create bordered font, and possibly more effects. | ||
− | === | + | === Example === |
− | '''Drawing black outline''': | + | '''Drawing black outline''': |
<source lang="lua"> | <source lang="lua"> | ||
local str = "My Composited Font text" | local str = "My Composited Font text" | ||
local nf = TTFont.new("fonts/Tahoma.ttf", 32, str, true) --Normal | local nf = TTFont.new("fonts/Tahoma.ttf", 32, str, true) --Normal | ||
local of = TTFont.new("fonts/Tahoma.ttf", 32, str, true, 3) --Outlined | local of = TTFont.new("fonts/Tahoma.ttf", 32, str, true, 3) --Outlined | ||
− | local cf= CompositeFont.new{ | + | local cf= CompositeFont.new{ -- *** PLEASE NOTICE THE CURLY BRACES { } INSTEAD OF ( ) *** |
{ font=of, color=0x000000 }, --Draw outline in black | { font=of, color=0x000000 }, --Draw outline in black | ||
{ font=nf, x=1, y=2 }, --Draw normal text with an offset | { font=nf, x=1, y=2 }, --Draw normal text with an offset | ||
} | } | ||
− | |||
local tf = TextField.new(cf, str) | local tf = TextField.new(cf, str) | ||
tf:setTextColor(0xff0000) | tf:setTextColor(0xff0000) | ||
Line 28: | Line 26: | ||
{|- | {|- | ||
| style="width: 50%; vertical-align:top;"| | | style="width: 50%; vertical-align:top;"| | ||
− | === | + | === Methods === |
− | [[Special:MyLanguage/CompositeFont.new|CompositeFont.new]] '' | + | [[Special:MyLanguage/CompositeFont.new|CompositeFont.new]] ''creates a new CompositeFont object''<br/> |
<!-- GIDEROSMTD:CompositeFont.new(definition) creates a new CompositeFont object --> | <!-- GIDEROSMTD:CompositeFont.new(definition) creates a new CompositeFont object --> | ||
| style="width: 50%; vertical-align:top;"| | | style="width: 50%; vertical-align:top;"| | ||
− | === | + | === Events === |
− | === | + | === Constants === |
|} | |} | ||
− | |||
{{GIDEROS IMPORTANT LINKS}} | {{GIDEROS IMPORTANT LINKS}} |
Revision as of 03:54, 30 March 2020
Supported platforms:
Available since: Gideros 2019.1
Inherits from: FontBase
Description
The CompositeFont class is used to define fonts composed from other fonts. It allows to mix a regular font with an outlined font to create bordered font, and possibly more effects.
Example
Drawing black outline:
local str = "My Composited Font text"
local nf = TTFont.new("fonts/Tahoma.ttf", 32, str, true) --Normal
local of = TTFont.new("fonts/Tahoma.ttf", 32, str, true, 3) --Outlined
local cf= CompositeFont.new{ -- *** PLEASE NOTICE THE CURLY BRACES { } INSTEAD OF ( ) ***
{ font=of, color=0x000000 }, --Draw outline in black
{ font=nf, x=1, y=2 }, --Draw normal text with an offset
}
local tf = TextField.new(cf, str)
tf:setTextColor(0xff0000)
tf:setPosition(16, 64)
stage:addChild(tf)
MethodsCompositeFont.new creates a new CompositeFont object |
EventsConstants |