Text formatting additions


I’m curious, are there are any plans to update the text formatting capabilties in Solar2D? Even simple italic (<i>) and bold (<b>) text within a text object would be helpful.

If you take even a cursory look at some of the “game” types being released on both Steam and Switch (as well as various outlets like itch.io) you can see that story and dialog driven games are very popular.

It would be nice to have at least basic formatting. It helps in conveying the story content and it’s really time to update the text rendering capabilities.

Rendering characters individually is not an answer for even a moderate level coder. I was able to add basic tags to text way back when I used Flash, so it should be doable?



Something like this would be a very nice addition.

rougier/freetype-gl: OpenGL text using one vertex buffer, one texture and FreeType (github.com)

1 Like

There are external solutions for this which I didn’t try yet but I agree, there should be a solution for rich text.

I didn’t try those but wanted to share it anyway.


I appreciate the response. I played around with the first one, but it’s based on iOS fonts, which my app is not. I was not able to manipulate it for common usage.

I will take a look at the other one as well. In general I have not been able to find an external solution, and it really should be more approachable to a new (or even long time user).

The bitmap font handling appears to be the only way to go. With something like the solution I mentioned, which handles all of the heavy lifting. It’s odd that Solar2D doesn’t support this already. It is supported in other engines.

But, I was thinking about it, and Solar2D seems to rely only on developer plugins at this point. I am trying to remember any significant feature updates in recent time.

This is not optimal as not everyone can create them. For basic items (yes, rich text should be a basic feature) it’s a bit ridiculous. Unless Solar2D is only in maintenance mode at this point?

And the support for helping developers (like myself) who do want to learn is seemingly non-existent and goes against all of the principles of what Solar2D is; a simple powerful development solution.


1 Like

There’s a workaround that might not be useful in your scenario, but it’s good for other scenarios
You can use a Webview, and use the power of HTML to view whatever you want however you want


Yes. I was thinking about that last night. I would have to see if it could work for my use case (which isn’t anything fancy) but even that is a step beyond what any developer should have to do for such a basic thing.

I actually brought this up maybe 8-9 years ago, so I am not expecting anything. But I think it’s important to be reminded that there are still some things that could be brought up to date. If it’s a matter of backwards compatibility, then just add a isRichText flag.

And thanks for the response. I appreciate it.


Slightly off topic, but I just recently started using Lua Color Convertor (it’s great). This is something, that again, should be baked in directly. No one should have to randomly find it.

My general concern is that Solar2D is becoming too developer centric and not embracing the principles of what makes it so great in the first place; usability.

For many, Solar2D is a first dip in the coding pool. A first instinct is not to search around for some solution for a basic need, which generally will be too specific, half-done, or not well documented. Solar2D has done absolutely fantastic on mitigating these issues for new, and even seasoned users. Will that be the case moving forward is the question.


This is an example I use in one of my apps:
Of course I had to learn some HTML to do it this way, my HTML knowledge is very basic

local htmString=[[<html>    
         <title>Your Title Here</title>    
         <h1 style="color:LightGray;font-size:50px;">Another Title Here</h1>      
         <p style="color:black;font-size:40px;">DynamicValueToBeReplaced</p>    
--YourVariableData  comes from somewhere which can be a score or anything else
local filePath = system.pathForFile( "msg.html", system.DocumentsDirectory )--Check If Local Data File Exists Or Not
  local file3 = io.open( filePath, "w" )
  local htmlContent=string.gsub( htmString, "DynamicValueToBeReplaced", YourVariableData ) 
  file3:write( htmlContent)
  io.close( file3 )

webView = native.newWebView( display.contentCenterX, display.contentCenterY, display.contentWidth-100, display.contentWidth-100 )
  webView:setNativeProperty("setAllowFileAccess", true)
  webView:request( "msg.html",system.DocumentsDirectory )
1 Like

Back in 2019, I was developing a text plugin called GBC Text Manager. I used it for my projects and was planning on adding so many more features. I did announce my intentions and asked for thoughts/opinions/features, but my announcement was met with little interest, so I shelved it.

Currently I only add features that I need for my projects, and since I haven’t really done a lot of Solar2D development lately, the plugin has been sitting in its current state for a while. I may bring this product out of retirement if all the planets align.

Info and Demo page:

GBC Text Manager – Candlelight (gamesbycandlelight.com)


Yeah, I am realizing that apparently this hasn’t been that important of an issue, which seems slightly baffling if folks are using Solar2D for business apps.

And generally I can understand. But, as a game engine, it needs to be able to produce games that are relevant in the market. And right now there is big movement in the narrative space.


Wow. This is really close to what I am looking for. But, having color and simple styling (italic, bold) would be excellent. Is that something you might look into in the future?, or is there code that I can hack on and try to make it work?

Nice job.


I do have a somewhat related plugin/module that is fairly close to being finished, but it is for bitmap fonts.

I’ve found that bitmap fonts work better in general. As the letters are individual display objects, you can animate them individually or apply other effects like fill colour or touch event listeners to individual letters or words, etc. Bitmap fonts also work the same across all platforms. With regular ttf and otf fonts, there may be slight differences in how the text gets formatted, but with bitmap fonts, they’re always the same regardless of the platform.

Edit: I took a look at @schizoid2k’s demo video and it seems like he is also working with bitmap fonts. :+1:

Yeah, after researching I can see why bitmap fonts are the way to go. Which is why they should have more first class support in the engine, and streamline the process of creation, and heck even animation and all the cool Solar2D bells and whistles. Just another nice toolkit. Where is my display.newBitmapText? :slight_smile:


1 Like

This was also one of the highest voted(not top 10 but…) feature requests back in Corona SDK days. When we were trying to build a text adventure game, this was a feature we needed. Most of the highest voted requests were completed but somehow, rich text support, HTML text support or whatever you call it, was not taken into account. I think it’d be great to have a rich text support baked into the engine or as a simple plugin.

@schizoid2k that looks nice by the way.

@Develephant Thanks! It’s been a few years since I worked on features, but I can try to find the code.

@bgmadclown Thanks as well!

@XeduR You are correct… my library was using bitmapped fonts.

I am going to try to find the code (its been pretty inactive since 2019) and if there is renewed interest, I may be able to find the time to revisit this.

1 Like

@schizoid2k I wrote to you (although I seem to be having trouble finding the conversation) after you alluded on the forum to another library you took as inspiration, asking about it. Would that have been TextMesh Pro? The name rings a bell, and the features seem about right, but I’m not sure.

I looked at the library @Develephant linked above, and that got me reviewing stb’s truetype, which seems to have gotten some attention since I last touched it. In the last couple of days I brought the changes into the truetype plugin and am trying to clean it up.

It’s kind of a hybrid library. There’s texture-baking stuff, but also a way to get the raw shapes of glyphs and then go to town with them. I’ve started revisiting the samples and have gotten those in much better shape. A quick GIF of some stuff:


The “wireframe” is just a bunch of lines generated from the shape information, the first meshes sample uses meshes with per-vertex colors, the next jitters the information a bit, and the contours bit will just gradually lay out points along the shape. At the moment I also have a setting in code for the sort of jitter (instant or transitioned), so you’re seeing a different one at the end.

The library itself is pretty low-level, but I think it would lend itself well to having a more user-friendly Lua layer on top.

As an aside, I also just finished Paper Mario: The Origami King, and the series always has fun with text. I went into it with that in mind, actually, before this topic started. :smiley: For example:


Hi @StarCrunch

When I started GBC Text back in 2018, I took inspiration from 2 packages. At the time, I was starting with Unity and loved Text Mesh Pro. For CoronaSDK (Solar2D) I had a text package called Text Candy by X-Pressive.

I saw that X-Pressive is still around, but they are no longer selling Text Candy. I thought I can put together a basic text library that I could use in my apps and GBC Text was started. There were some things that I did not like about Text Candy and I wanted to see if I can improve that on GBC Text. For example, with GBC Text, you do not have to delete and recreate a text string if the text changes… you can just update the text and my library will dynamically change the length of the string and update the characters.

I did use my lib in some of my projects but shelved it after a someone lackluster response when I posted it in the forums. I had a lot of plans for enhancements but time is always limited and didn’t want to dedicate cycles on something that would not be used outside of me. I believe I found the code, and if/when I need an update, I add to it.

With this renewed interest in text formatting, I am unsure whether I should pick this back up, or making it open source.

I do recall out previous conversations (although I also cannot find the archive), and at the time I was impressed. These updates are also quite impressive. I look forward to your development as well.

I hope this helps a bit. Currently I am thinking through what (if anything) I should do with my library.



Just to add my 2c worth we need display.newRichText() my like most other languages have.

Ideally also display.newHTMLText() but that is just wishful thinking…

Bitmap text is not the solution when you have multiple languages to support!

1 Like

Update: There seems to be another solution in the making from the developer of Dahlia Studio @devex . I don’t know whether they’ll open up the source but rich-text support for the editor is mentioned in the devlog.

By the way, I’m also OK with a good working, free plugin that we can use.

I’ve tried to tidy up the samples for the truetype plugin lately:

truetype_sample.zip (362.5 KB)

That’s largely what’s shown in the GIF, but a lot of consolidation’s been done, with some patterns getting parked in a utils module. There’s also a shortlist of stuff to investigate in main.lua, though I’ve also got vague ideas of what I might do throwing some other plugins at this stuff.

I’ve been skimming over the TextMeshPro stuff, rich text in particular, the last couple days, to try to feel out what could be done without extreme effort. Maybe about half of it. I’m not sure API-wise what would be a nice way to approach font switching; the actual implementation might not be awful, but kerning would probably be a kludge.

EDIT: Any interesting work now is likely to be on the Lua side, probably as further samples.

1 Like