mojira.dev
MC-70915

Alignment bug when using wide (>7px) glyphs in unicode font

When using a unicode font with a symbol width more than 7px, the space for the glyph considers 15 and:
1) Center-aligned text floats to the left.
2) Spaces occurs in mouse-hover-tip texts.
3) Less characters fits the chat/signpost. E.g. for 8 chars with 8 px width (+2px spaces = 78px) the game allocates 8x15 field (=134px), which is almost twice wider than it should be.
And, as you can see on the screenshot, only 26 symbols was put in a line instead of 41. Ye, to compare the fonts there was set English language, so you see the original ASCII latin font there.

How to reproduce:
1) Download and activate the attached resource pack.
2) Restart the game (otherwise the glyph_sizes.bin won't be loaded from the respack).
3) Enable "Force Unicode" option (or set Bulgarian/Russian/Serbian language).

Suggestion how to fix:
In 1.6 and 1.7 (and I believe it's still goes the same way in 1.8, but I can't assert it as I haven't seen its code yet), the problem was in the FontRenderer class, precisely in these two lines:
...
} else if (this.glyphWidth[ symbol ] != 0) {
int start = this.glyphWidth[ symbol ] >>> 4;
int stop = this.glyphWidth[ symbol ] & 15;
// === THESE TWO LINES: ===
if(stop > 7)
{ stop = 15; start = 0; }
// =============
stop += 1;
return (stop - start) / 2 + 1;
} else {
...

As it's still wasn't removed, I believe it fixes widths of some hieroglyphs, but obviously it should be isolated from latin and cyrillic charsets. (You know better how it works, so I think you'd found a good way to do it).

PS: Yes, it is a repost of MC-23952 which was marked as resolved, but it wasn't solved in fact.

PPS: As the whole thing with font changing is mostly workaround for not-yet-implemented feature, you may ask, why the hell I'm posting it as a bug. Because the font changing wasn't implemented for more than year, I think. And the original unicode font is quite... not perfect. To be honest, today Minecraft just looks like a game, which is released and overstuffed with various features, but still has pre-alpha-stage fonts, and it makes a really irritative dissonance in players' mind.

Linked issues

Attachments

Comments

Anton Morozov

Affects 1.8.8

marcono1234

Duplicates MC-23952

Robert Kalinowski

It seems to be fixed in 1.10.2.

Vsevolod

(Unassigned)

Community Consensus

Minecraft 1.7.10, Minecraft 1.8, Minecraft 1.8.8

Retrieved