Hello, want to introduce my defold-printer module. I used it several times for my games and want to share it with you.
I know, what there is defold-richtext module by Britzl, but my module have different way to use it.

Link on github:

In my module you can create styles for your text and reuse it for making easy nice looking dialogs :slight_smile:


  • Configurable text styles
  • Designed for dialogs. Easy skip and go to next text
  • Source styles - you can define default style for special source (ex. character in your game)
  • Word styles - you can define style for special word. It will auto-wraped with special style
  • Images in text
  • Text can have waving, shaking, slowly appearing, custom color, custom spacing and custom sound when appear

Text with styles looks like:
{Illidan_name}Illidan{/}: you are {red}not {waving}prepared{/}!

Read full README or see example at github


  • Vertical and Horizontal align
  • Get text metrics for resizing your bubble text
  • More style parameters
  • Optimize code and node creating

If you will use it and have suggestions, do not be shy and tell me about it!


Team working
In my project, I have the sheet in google docs for settings styles. Example:

So, other members of the team can setup styles and use it in localizations. Translations is also very simple with style tags.
Also, source and word styles can be also setup with google docs. Example:
locale_id - localized word. For example, printer_bob_name in English will be Bob, so all words in dialog “Bob” will be printed with style bob

Template setup
While setting text area, you can set visible printer/text_parent and setup this node size. The text will write in this area. After setup, you can set alpha to 0 and place your background behind printer template


Very nice!


Wow! It’s brilliant, I need to check this out :smiley:

1 Like

Cool! Thanks for sharing!

1 Like

Great Module!! Love it :heart: !! Thanks for sharing :wink:

1 Like

I’m using this for a project, and the way I wanted to use it required doing some work that seems like it would fall under some of the To-Do list.

Here is a copy of the pull request outlining what I did for anyone curious:

Bug(?) fixes:

  • The hex conversion function from colors.lua presented problems when trying to hide a printer with already printed text via manipulating the alpha value. Any text colored by a style would still be visible since the value was hardcoded in the color conversion.
    → This was fixed by providing the conversion with the printer’s self-reference, so we could get the alpha value via gui.get_color using the NodeProxy stored in self.prefab

  • The math for creating new lines is changed as it presented odd behaviour when trying to align the text using the pivot options in the GUI node for the text parent and resize a textbox around it using text metrics. This has been mostly fixed, although important to note is that the text input into the metrics calculation needs to be sanitized to remove the style wrappers (we need to ignore things such as {/}). I have written a sanitize() function for this in another project, but have not added it because I think it needs a better name, and maybe even should ultimately just be changed to a text metrics function.

Added features:

  • The style tables can now take a parameter line_spacing which is added to the distance between new lines.
  • Added a fadeout() function which animates the alpha channel of all the nodes contained in self.current_letters
  • Non-conflicting styles can now be compounded when not explicitly exited with {/}. For example, if you have a style with color as a param and another with waving as a param and provide printer with the following text:
"{colorstyle} alpha beta {wavestyle} gamma {/}"

Before, doing {wavestyle} would cancel {colorstyle} even though their parameters don’t conflict - meaning to have color AND waving for the word ‘gamma’ you would need to create an entirely new style.
Now, the styles can be stacked, with the last declared style taking priority if there are any conflicting parameters. This is done by storing the last style in self.last_style and overwriting the defaults in get_style() with any existing parameters. This temporary stored style is cleared only when the styles are explicitly exited using {/}.

In case Insality can’t merge (maybe backwards compatibility problem I may have missed?), a link to my fork for anyone coming across this and sees those changes as useful:

Also considering on forking again from my fork to provide a specific implementation of printer with some useful features built into a GUI script and a modified prefab that resizes automatically (still needs work on making the text metrics account for the line_spacing feature I added).


It’s awesome! Thanks for your PR! :heart:

I will check it fully later. I think I’ll merge this to the main repository and make new release, since several breaking changes are included here.