TexturePackFont.new
From GiderosMobile
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
Available since: Gideros 2021.9
Class: TexturePackFont
Description
Creates a new TexturePackFont object.
TexturePackFont.new(texturePack,mappings,scale,anchor)
Parameters
texturePack: (TexturePack) the TexturePack object that will be wrapped in this font
mappings: (table) a character to filename map to associate characters with TexturePack images
scale: (double) a scale factor to apply to the texture pack images (default = 1)
anchor: (double) where the images should be laid relative to the text baseline (default = 1)
Example
Try to simulate arabic letters
local tp = TexturePack.new({"fonts/ar_ba.png", "fonts/ar_ta.png", "fonts/ar_tha.png"}) -- path to png images
local font = TexturePackFont.new(tp, {ba="fonts/ar_ba.png", ta="fonts/ar_ta.png", sa="fonts/ar_tha.png"}, 3, 0) -- tp, mappings, scale, anchory
local tf = TextField.new(font, "bata")
local tf2 = TextField.new(font, "taba sa")
local tf3 = TextField.new(font, "sa")
tf:setPosition(64*6, 64*1)
tf2:setPosition(64*6, 64*2)
tf3:setPosition(64*6, 64*3)
stage:addChild(tf)
stage:addChild(tf2)
stage:addChild(tf3)