Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Colored & styled text would be nice #6

Open
kig opened this issue Apr 29, 2016 · 1 comment
Open

Colored & styled text would be nice #6

kig opened this issue Apr 29, 2016 · 1 comment

Comments

@kig
Copy link

kig commented Apr 29, 2016

In doing the syntax highlighter for https://tabletree.io I had to figure out a way to efficiently color & style text geometries with bold & italics. Would be nice to have something like that built in.

My current version uses the w-coord of the text geometry vertices to store a palette index and a faux-bold flag that changes the SDF threshold. The palette is passed in as a uniform array. The faux-italics are baked into the geometry by shifting the x-coord of top verts to the right and bottom verts to the left (should be possible to do in the vertex shader too, but smells a bit complicated).

The Right Way to do the bold/italic thing would be to use a separate font variant. And use a texture for the palette.

@kig kig mentioned this issue Apr 29, 2016
@mattdesl
Copy link
Contributor

mattdesl commented May 2, 2016

There's lots of different ways of doing things so I'd rather not make three-bmfont-text too opinionated to a particular technique. It's worth discussing and seeing if we can make some standard shaders that users can opt-in to.

In past projects we've packed many styles/fonts/variants into a single atlas with gdx-fontpack, but it does not support SDF. I would love to see a fully node version of that (e.g. with node-fontnik or freetype2).

Proper styling tends to get very complicated since it affects word wrap and line alignment. I was experimenting here but never finished it, and it still has some bugs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants