I can’t remember the parser code exactly so I can’t make any promises. Could you please create a GitHub issue?
Tbh, I wonder if you should have some other function to “clean up” your input?
It feels kind of strange that a library such as Defold-RichText should need to handle all “text from the internet”?
Haha, true. That’s why I asked. I wasn’t sure which would be easier, and it could be a nice feature for RichText to be able to handle overlapping tags.
I am playing around making a MUD client.
@britzl I’ll make an issue, and if it turns out to be a “won’t add” feature, no worries.
“Easier” doesn’t always equal “correct”
I’ve made multiple improvements to RichText:
- Support for nested and overlapping tags. I managed to figure out a pretty good solution that doesn’t add much overhead.
- Support for HTML entities
>
<
and
- Added new tags to control text shadow and outline:
<shadow color=red>
and<outline color=#FF00FFFF>
- Added zero-width space character support via custom HTML entity
&zwsp;
. This is useful when adding a pause when revealing text one character at a time using richtext.truncate() - Added option to truncate full words instead of per character via
richtext.truncate(words, length, { word = true })
i have a trable, i included the https://github.com/britzl/defold-richtext to my project, but the rich-text node doesn’t show((9
but when i use the code, it works
local settings = {
width = 400,
parent = gui.get_node("Orders"),
color = vmath.vector4(0.95, 0.95, 1.0, 1.0),
shadow = vmath.vector4(0.0, 0.0, 0.0, 1.0),
}
local text = "<color=red>KEks</color>"
richtext.create(text, "Caveat", settings)
@pes7 That’s how it would be with Rich-Text - it’s a wrapper to use some complicated operations on built-in gui nodes in a user friendly way - so you don’t need to clone and show every letter as a separate gui by yourself - Rich-Text does it for you But I suspect what you expected - a special new node in the Add menu to add a Rich-Text - as you can see, this is not needed, because you can use built-in nodes
yes, but i don’t know how to use it in normal node like a text. and i can’t find it in manual to this aset. And i can’t check the example, because defold is crushing when i load it up. And i am not undestand how to use in on my gui, not on gui_script
Is Defold crashing when you try to start the example project shipped with the extension?
I’m unable to reproduce any crash. Please share additional details.
I added files to my project with the extension. But, i will try to lode your example manualy from your dir soon.
Try this:
- Download the project from here: https://github.com/britzl/defold-richtext/archive/master.zip
- Unzip
- Double-click on example/game.project
- Build and run
ohhh, i am loaded it. cool really. but so much code( but really cool. it will be much better if someone can hold it unto new node or something else
What do you mean? What do you wish to do specifically?
I’m having an issue with RichText. I see there was some talk about vertical alignment earlier and I suspect this is related. I am using RichText primarily for the purpose of embedding symbols in my text (for example, “This attack causes EXPLOSION” would look something like “This attack causes ”.
This is the text example I have generated:
As you can see, the smiley face and the bear are both not aligned correctly with the text.
The smiley face is an image, and the bear is a font (bit larger than I want it to be, but just trying to highlight the issue). Is there a solution for this in RichText already, and am I just missing it? Or is this something that isn’t implemented?
Not supported yet but definitely something that could be supported. A vertical alignment setting or something like that.
Please create an issue.
Done - hope it looks the way it should do!