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

Negative "advances" in font draws text with inconsistent Z order

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Invalid
    • None
    • 1.19 Pre-release 3, 1.19
    • None
    • Confirmed
    • (Unassigned)

      The bug

      The "space" font provider added in 22w11a was intended to provide an alternative for the old "negative spaces" hack. However, using this provider differs from the old method in a way that limits its utility.

      How to reproduce

      Make a resource pack with this font

      {
         "providers": [
            {
               "type": "bitmap",
               "file": "minecraft:block/white_concrete.png",
               "ascent": 0,
               "height": 16,
               "chars": ["a"]
            },
            {
               "type": "space",
               "advances": {
                  "b": -4
               }
            },
            {
               "type": "bitmap",
               "file": "minecraft:gui/demo_background.png",
               "ascent": -32768,
               "height": -6,
               "chars": ["c"]
            }
         ]
      }
      

      Now run these two commands:

      /tellraw @a [{"text":"","font":"your:font"},{"text":"a","color":"blue"},"bb",{"text":"a","color":"red"},"bb",{"text":"a","color":"green"},"bb",{"text":"a","color":"yellow"},"bb",{"text":"a","color":"gray"}]
      
      /tellraw @a [{"text":"","font":"your:font"},{"text":"a","color":"blue"},"cc",{"text":"a","color":"red"},"cc",{"text":"a","color":"green"},"cc",{"text":"a","color":"yellow"},"cc",{"text":"a","color":"gray"}]
      

      The first command uses the space provider to create negative spaces, and it looks like this:

      The second command uses a large image with negative height to create negative spaces, and it looks like this:

      The second appearance is more desirable, since the text later in the string appears on top of text earlier in the string.

      Note that although it may appear they are simply reversed, that's not so. With the space provider, the layering of text seems to be arbitrary and unpredictable for larger messages, which seems to preclude the effective usage of negative spaces, where text is intentionally overlapping.

            Unassigned Unassigned
            tryashtar [Mod] tryashtar
            Votes:
            3 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:
              CHK: