mojira.dev
MC-23952

Bad alignment when using wide unicode fonts

When using unicode font with a symbol's width more than 8px, text floats to the left.

How to reproduce:
  1. Take a resource pack from attachments.

  2. Select the resource pack in the game.

  3. Restart the game.

  4. Change language to Pirate Speak, French, etc.

Linked issues

Attachments

Comments

Erik Broes

I think you need to work harder to reverse engineer the glyph_sizes.bin.

rumickon

Thanks for reply Grum.
Ok. When I am using another font with a symbol's width 8px or less it looks good (screenshot 06). But if symbol's width is 10px (screenshot 07) then text floats to the left. I edit the file manually by hex-editor. What do I do wrong?
P.S. Same problem width default font and Hindi language (screenshot 08).

Jumpin Carrot

rumickon, Did you figure out how to fix this? I'm trying to solve the same problem with no luck.

rumickon
Jumpin Carrot

Wow, that helped. Thank you very much.

Reality_SC

I confirm the problem in 13w42b.

Reality_SC

The only way to make it working is decompile .jar, find FontRenderer.java and comment this condition lines:
...
} else if (this.glyphWidth[ symbol ] != 0) {
int start = this.glyphWidth[ symbol ] >>> 4;
int stop = this.glyphWidth[ symbol ] & 15;
/* HERE:
if(stop > 7) { stop = 15; start = 0; }
*/
stop += 1;
return (stop - start) / 2 + 1;
} else {
...

I don't understand the aims of this condition.

rumickon

Fix for 13w42b: azz.class in attachments.

Reality_SC

I think Mojang should patch this cause this is a bug.
We can create patches for every version but this is not right way.

Jumpin Carrot

Mojang doesn't want to fix this. It's marked as resolved and "Works As Intended". They just don't care.

marcono1234

Why is this "Works As Intended" now?

Dlawso the Really Lucky Rabbit

Marcono and Jumpin Carrot, from the words of Grum:

I think you need to work harder to reverse engineer the glyph_sizes.bin.


Resolution Works As Intended [ 6 ]
Status Open [ 1 ] Resolved [ 5 ]

marcono1234

Nice ...

Reality_SC

Can @rumickon reopen it? It does not works as should. To fix it in code @Grum should remove just one simple construction in "FontRenderer.java".

rumickon

No, I can't. But we have another bug: MC-27912 with same problem.

Jumpin Carrot

But it's not just Hindi, wide variety of unicode fonts are affected. The main problem is in the fonts: many fonts are too thin and mismatch overall style of Minecraft, also they are hard to read. If anyone tryes to fix this with resource pack\custom fonts, they are faced with the need to change widths in glyph_sizes.bin And if you do so, all text becomes misaligned.
This makes this problem unsolvable! The only way left is to decompile FontRenderer.java for each version of Minecraft.

Christie N

The intention with the unicode font seems to be to have a variable-halfwidth font (for Latin/Greek/etc.) and a fixed-fullwidth font (for CJK/etc.). However, the glyph_sizes.bin file doesn't reflect this, with regular points reading 1e, and others ending in -a, -b, or -c. This is causing the distortion. Every fullwidth character in the glyph_sizes.bin should be of width 0f.

Note that the Unicode font (GNU Unifont) is a fixed-width font.

Reality_SC

Recently I found fixing solution that is appropriate for me. For not to decompile client just 1. Find .class containing "glyph_sizes.bin" string in bytecode — there always be only one file for any minecraft version (made from FontRenderer.java). 2. Find the bytes 10 07 A4 and replace them with 10 0F A4 with your favorite hex editor. These bytes are the code for "if(charWidth > 7)" so here we change it to "if(charWidth > 15)" that is never true. Working with Optifine bytecode too.

rumickon

@Reality_SC yep. Change one bit only.

Christie N

Probably related, Minecraft has no support for combining diacritics, so why are they even allowed past Crowdin?

rumickon

Reopen please

Dlawso the Really Lucky Rabbit

Likely 0% chance of reopening because a Mojang employee resolved it as intended.

rumickon

Also, this problem was solved in Forge after that commit: https://github.com/MinecraftForge/MinecraftForge/pull/1804
Its very easy to fix. Why Mojang employees ignore it, I do not understand.

marcono1234

Confirmed for

This is definitely valid, like @unknown said already in his comment these lines mess everything up. For example they return for both ① (\u2460) and ╬ (\u256c) the same size (force unicode is off) even though when writing one line of ① and below it one line of ╬ you will see that they have not the same size.
This is in the method getCharWidth(char p_78263_1_) of the class /Client/src/net/minecraft/client/gui/FontRenderer.java (MCP 1.8 names).

if (var4 > 7)
{
	var4 = 15;
	var3 = 0;
}
marcono1234

Can you please include this?

[Mod] redstonehelper

The ticket is resolved anyway. If they choose to look at it again they will see your comment.

marcono1234

Confirmed for

  • 15w51a

Bugs that are caused by this:

rumickon

migrated

Unconfirmed

fonts, resource-pack

Minecraft 1.6.1, Minecraft 1.6.2, Minecraft 1.8.8, Minecraft 15w43b, Minecraft 15w46a, ..., Minecraft 15w47b, Minecraft 15w47c, Minecraft 1.8.9, Minecraft 15w50a, Minecraft 15w51a

Minecraft 16w02a

Retrieved