britzl / defold-richtext

Defold-RichText is a system to create styled text based on an HTML inspired markup language
MIT License
75 stars 12 forks source link

Custom tags or classes #2

Closed britzl closed 6 years ago

britzl commented 6 years ago

Add the ability to apply custom tags and then provide a function to return all nodes with a specific tag/class

britzl commented 6 years ago

Fixed in https://github.com/britzl/defold-richtext/releases/tag/2.0.0

local words, metrics = richtext.create(...)
local bold_words = richtext.tagged(words, "b")
for _,bold_word in pairs(bold_words) do
    print(bold_word.text, bold_word.node)
end