How would I go about rendering all Unicode characters?
Most font files don't include characters like these.
How would I go about rendering all Unicode characters?
Most font files don't include characters like these.
My approach is to do the following:
Below is a snippet of my Java sprite batching code, used to draw the text.
public void draw(final String text, final float sx, final float y, final int layer) {
float x = sx;
for (final char c : text.toCharArray()) {
this.draw(CHARACTERS.get(c), x, y, layer);
x += 7 * this.scale;
}
}
As for the font files not including the characters: if you don't have the characters to draw, you can't draw them, so you'll have trouble finding a sheet with all of these different characters.
it's impossible
is not best answer for this.
\$\endgroup\$
Commented
Nov 16, 2015 at 19:17
If you cannot find a single font containing all glyphs you want, you will have to have multiple fonts.
Some text rasterisation APIs have "font linking" or "font substitution" in which they use more than one font as fallback for missing glyphs. This tends to result in a sub-optimal result in terms of character advances, relative glyph size, and kerning - but it at least shows something that may be recognizable as a glyph.
If you do your own rasterisation of individual glyphs, gather enough fonts with suitable licenses, rank then in order of preference and gather glyphs from them.
You may have to restrict yourself to a subset of character ranges -- do you really need every current codepoint in existence in your game?