FontBase Constants

From GiderosMobile

Available since: Gideros 2011.6
Defined by: FontBase

FontBase Constants

  • FontBase.TLF_BOTTOM align text to the bottom, Gideros 2017.10
  • FontBase.TLF_BREAKWORDS allow Gideros to break words that exceed required width, Gideros 2018.3.2
  • FontBase.TLF_CENTER center text horizontally, Gideros 2017.10
  • FontBase.TLF_JUSTIFIED justify text horizontally, Gideros 2017.10
  • FontBase.TLF_LEFT align text to the left, Gideros 2017.10
  • FontBase.TLF_LTR left to right text, Gideros 2019.12
  • FontBase.TLF_NOBIDI non bi-directional text, Gideros 2019.12
  • FontBase.TLF_NOSHAPING turn off HarfBuzz shaping, Gideros 2019.12
  • FontBase.TLF_NOWRAP don't wrap long lines, Gideros 2017.10
  • FontBase.TLF_REF_ASCENT use ascent of line as reference, Gideros 2019.12
  • FontBase.TLF_REF_BASELINE use baseline as reference (default), Gideros 2017.10
  • FontBase.TLF_REF_BOTTOM use bottom of line as reference, Gideros 2017.10
  • FontBase.TLF_REF_DESCENT use descent of line as reference, Gideros 2019.12
  • FontBase.TLF_REF_LINETOP use top of a line of text of that font, irrespective of the text actually displaying, Gideros 2018.3.3
  • FontBase.TLF_REF_MEDIAN use median of line as reference, Gideros 2019.12
  • FontBase.TLF_REF_MIDDLE use middle of line as reference, Gideros 2017.10
  • FontBase.TLF_REF_TOP use top of line as reference, Gideros 2017.10
  • FontBase.TLF_RIGHT align text to the right, Gideros 2017.10
  • FontBase.TLF_RTL align text right to left, Gideros 2019.12
  • FontBase.TLF_TOP align text to the top, Gideros 2017.10
  • FontBase.TLF_VCENTER center text vertically, Gideros 2017.10

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)