mimetic / corona-textrender

A pure-Lua text rendering module for Corona SDK which can handle basic HTML, fonts, font-styles, and even basic font metrics. (Takes over from corona-styled-textwrap)
24 stars 7 forks source link

Change options of autoWrappedText at runtime #9

Open stephan507 opened 4 months ago

stephan507 commented 4 months ago

Hi, is there a way to change the options of a textrender object at runtime?

E.g.:

local options = { text ="Click me", font = "Futura-Bold", size = "20", lineHeight = "20", hyperlinkTextColor = "255,255,255,255", -- an RGBa color in a string, like this: "200,120,255,100" opacity = "100%", width = 200, -- width of the column of text alignment = "Left", -- default text alignment, note the initial capital letter minCharCount = 100, -- Minimum number of characters per line. Start low. maxHeight = 26, handler = touchCallback, -- a function that will accept a 'tap' event isHTML = true, -- TRUE if the text is simplified HTML styled text } local link = textrender.autoWrappedText( options )

function touchCallback(event) link.hyperlinkTextColor = "255,0,0,255" link.text = "Don't click me" end