Defold-RichText

Added in defold-richtext 2.3.0. You can now pass in align in settings with one of richtext.ALIGN_LEFT, richtext.ALIGN_CENTER or richtext.ALIGN_RIGHT.

This is probably the last release I’ll do in a while. I’m gonna wait for feedback from users and makes changes based on that feedback.

5 Likes

I’m making a visual novel kit soon and will use Defold-RichText with it.

4 Likes

This was a lie! @Pkeod started experimenting and provided a bunch of suggestions. Added richtext.truncate(words, length), richtext.length(text) and richtext.characters(word) functions. Makes it quite easy to do text effects such as these:

waves

Released defold-richtext 2.5.0

11 Likes

Sweet baby ray, this is awesome!

4 Likes

astrologists proclaim the week of text RPGs #MadeWithDefold

8 Likes

my space shooter is now also an rpg adventure

9 Likes

Released 2.8.0 to fix a bunch of issues reported by @pkeod. I also added experimental support for spine models. Finally it’s now possible to easily assign layers to the generated nodes to reduce draw calls.

spineboy

5 Likes

rt.zip (841.9 KB)

Edit: made slight adjustment

2 Likes

Thanks! I can honestly say I didn’t give my choice of hero and thumbnail image much thought, but I appreciate you sprucing it up!

3 Likes

I think you should rename is Richie Text!

2 Likes

Or something close to “Ritzl”? Like Ritzh Text? :joy:

Also thanks for this @britzl, I love it! Really make it a lot easier to do fun text stuff :smiley:

6 Likes

I’m trying to figure out a way to have a blinking cursor at the end of a truncating text . Any tip on how to solve that?

Essentially you’d have to figure out the position of the last character after each truncate call. Is there way to access the inner text gui component and get width data on the last line perhaps?

Ah, yeah, that’s currently not very simple to achieve. The call to truncate() should probably return the last visible node of the text. Created issue: https://github.com/britzl/defold-richtext/issues/24

3 Likes

Added support for this now. The truncate() function will now return the last visible word. The function will also update the text metrics of truncated nodes. Added an example with a cursor following truncated text as it is revealed.

5 Likes

Suh-weeet!

2 Likes

Speaking of stuff at the end of text. In our tutorial, I have this pulsating arrow indicator at the end of a text bubble indicating that the game expects the user to click to advance:

The problem is that, since it’s so small, sometimes it overflows on its own, which looks bad:

A way to control overflow would be really useful. I’m not really sure how it would be implemented. I don’t really have an API proposal I’m happy with. Maybe a <nobreak>words that don't break</nobreak> tag?

4 Likes

Thank you for the feature request! Added: https://github.com/britzl/defold-richtext/issues/25

5 Likes

I decided to revive the old and deprecated <nobr> HTML tag. It might not be good enough for browsers but it’s damn well good enough for Defold-RichText!

8 Likes

Coming up next, marquee and blink!

5 Likes

Hi All!!

I’m having some trouble with this and I have no idea where to get started. Here are my steps.

I want to make my countdown cooler by having the minutes being larger than the seconds. I want to do this via richtext. Here’s what I’ve done:

  1. Added https://github.com/britzl/defold-richtext/archive/master.zip as a dependency
  2. Did project -> fetch libraries and sychronised
  3. Checked that richtext appears in my project with the jigsaw piece icon
  4. What should the code be? And have I missed anything here?

Here’s my guess for the code so far:

	local minutes = 320
	local seconds = 182
	richtext.create(minutes.."."..<size=2>seconds</size> )

But that’s not right. Any help?

I am getting

/main/guiscript.gui_script:2: attempt to index global ‘richtext’ (a nil value)
stack traceback:

which makes me assume that I haven’t installed the dependency correctly!