Mojira Archive
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;
			}
			
			//...
		}
	}
}