FontBase Constants
From GiderosMobile
Available since: Gideros 2011.6
Defined by: FontBase
FontBase Constants
- FontBase.TLF_BOTTOM align text to the bottom
- FontBase.TLF_BREAKWORDS allow Gideros to break words that exceed required width
- FontBase.TLF_CENTER center text horizontally
- FontBase.TLF_JUSTIFIED justify text horizontally
- FontBase.TLF_LEFT align text to the left
- FontBase.TLF_LTR left to right text
- FontBase.TLF_NOBIDI non bi-directional text
- FontBase.TLF_NOSHAPING turn off HarfBuzz shaping
- FontBase.TLF_NOWRAP don't wrap long lines
- FontBase.TLF_REF_ASCENT use ascent of line as reference
- FontBase.TLF_REF_BASELINE use baseline as reference (default)
- FontBase.TLF_REF_BOTTOM use bottom of line as reference
- FontBase.TLF_REF_DESCENT use descent of line as reference
- FontBase.TLF_REF_LINETOP use top of a line of text of that font, irrespective of the text actually displaying
- FontBase.TLF_REF_MEDIAN use median of line as reference
- FontBase.TLF_REF_MIDDLE use middle of line as reference
- FontBase.TLF_REF_TOP use top of line as reference
- FontBase.TLF_RIGHT align text to the right
- FontBase.TLF_RTL align text right to left
- FontBase.TLF_TOP align text to the top
- FontBase.TLF_VCENTER center text vertically
Example
Text wrap
application:setBackgroundColor(0x6c6c6c)
-- some vars
local width = application:getContentWidth()
local height = application:getContentHeight()
local mystring = [[
Some very long text. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed non risus. Suspendisse lectus tortor,
dignissim sit amet, adipiscing nec, ultricies sed, dolor.
xxxxxxxxxxxxxxxxxxxxxTLF_BREAKWORDSxxxxxxxxxxxxxxxxxxxxxxxxTLF_BREAKWORDSxxxxxxxxxxxxxxxxxxxxxxxxTLF_BREAKWORDS,
Some very long text. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed non risus. Suspendisse lectus tortor,
dignissim sit amet, adipiscing nec, ultricies sed, dolor.
Some very long text. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed non risus. Suspendisse lectus tortor,
dignissim sit amet, adipiscing nec, ultricies sed, dolor.
]]
local textfield = TextField.new(nil, mystring)
textfield:setSample(mystring)
textfield:setLayout( {w=width/3, h=height/2, lineSpacing=2, flags=FontBase.TLF_CENTER|FontBase.TLF_BREAKWORDS} )
textfield:setScale(2)
textfield:setPosition(8, 8)
stage:addChild(textfield)