Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-45254

Bold text is not correctly (right/center) aligned (invalid string length)

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Minecraft 14w03b
    • Minecraft 1.7.4
    • Windows 8.1 (x64)
      java version "1.7.0_40"
      Java(TM) SE Runtime Environment (build 1.7.0_40-b43)
      Java HotSpot(TM) 64-Bit Server VM (build 24.0-b56, mixed mode)
    • Unconfirmed

      The following code was used to test:
      fontRenderer.drawStringWithShadow(str, x - fontRenderer.getStringWidth(str) , y, color);
      where string is the text on the left side of the screen, x is the width of the screen - 2, y is 2 and color is 0xFFFFFF.

      The gui scale is set to normal; any pixel units bellow should be divided by 2 for the actual (code) values.

      The first line is normal text, used as a reference.
      The second line is a bold modifier, followed by 15 color modifiers. The expected result should be something similar to the third line, but the color modifier seems to override the bold modifier.
      The third line contains 15 color modifiers followed by a bold modifier. The bold modifier is applied as expected, but one can see a 2 pixel difference compared to the first line.
      The fourth line is simply 15 color modifiers is what is expected.
      The fifth and final line is 15 bold modifiers. One can clearly see the difference with the first line (30 pixels).

      Subtracting the amount of bold modifiers solves the issue with lines 3 and 5.

      Possibly related to MC-23952.

            Unassigned Unassigned
            lunatrius Jadran Kotnik
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: