mojira.dev
MC-76356

Bold unicode characters appear doubled

When you set Force Unicode: False and try to write bold unicode characters like

/tellraw @p {"text":"","bold":true}

You will get a doubled ∓.

The reason for that is that the method renderStringAtPos(String p_78255_1_, boolean p_78255_2_) in the /Client/src/net/minecraft/client/gui/FontRenderer.java class (MCP 1.8 names) sets a different offset for characters only if unicode is forced, however it ignores the fact that unicode characters can be displayed without unicode being forced. This offset would also affect the shadow of characters but this is disabled for unicode characters by default.

/**
 * Render a single line string at the current (posX,posY) and update posX
 */
private void renderStringAtPos(String p_78255_1_, boolean p_78255_2_)
{
	for (int var3 = 0; var3 < p_78255_1_.length(); ++var3)
	{
		char var4 = p_78255_1_.charAt(var3);
		int var5;
		int var6;

		if (var4 == 167 && var3 + 1 < p_78255_1_.length())
		{
			//...
		}
		else
		{
			//...
			
			// Changed this
			//float var12 = this.unicodeFlag ? 0.5F : 1.0F;
			float var12 = var4 == 0 || var5 == -1 || this.unicodeFlag ? 0.5F : 1.0F;
			boolean var7 = (var4 == 0 || var5 == -1 || this.unicodeFlag) && p_78255_2_;
			
			if (var7)
			{
				this.posX -= var12;
				this.posY -= var12;
			}

			float var8 = this.renderCharAtPos(var5, var4, this.italicStyle);

			if (var7)
			{
				this.posX += var12;
				this.posY += var12;
			}

			if (this.boldStyle)
			{
				this.posX += var12;

				if (var7)
				{
					this.posX -= var12;
					this.posY -= var12;
				}

				this.renderCharAtPos(var5, var4, this.italicStyle);
				this.posX -= var12;

				if (var7)
				{
					this.posX += var12;
					this.posY += var12;
				}

				++var8;
			}
			
			//...
		}
	}
}

Linked issues

Attachments

Comments 9

Can confirm in 1.8.2-pre1.

The unicode font uses a different point value (16 point instead of 8 point).

And what does this mean in this case?

Still in 1.9.1-pre3

This appears to be fixed in 1.13-pre7

Bold still looks pretty horrible because of the offset doubling method used. If the font supports "bold", why not use THAT font's "bold" from TTF?

Still an issue in the full 1.13 release and 1.13.1

marcono1234

(Unassigned)

Confirmed

bold, doubled, font, ttf, unicode

Minecraft 1.8.2-pre1, Minecraft 15w37a, Minecraft 15w50a, Minecraft 1.9, Minecraft 1.9.1 Pre-Release 3, ..., Minecraft 1.12.2, Minecraft 18w03b, Minecraft 18w11a, Minecraft 18w15a, Minecraft 1.13-pre6

Minecraft 1.13-pre7

Retrieved