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

Alignment bug when using wide (>7px) glyphs in unicode font

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • None
    • Minecraft 1.7.10, Minecraft 1.8, Minecraft 1.8.8
    • None
    • Linux Mint 14 x64, java version "1.7.0_21" Oracle Corporation
      Windows 7 Home Premium x64, Java 1.7.0_67-b01
    • Community Consensus

      When using a unicode font with a symbol width more than 7px, the space for the glyph considers 15 and:
      1) Center-aligned text floats to the left.
      2) Spaces occurs in mouse-hover-tip texts.
      3) Less characters fits the chat/signpost. E.g. for 8 chars with 8 px width (+2px spaces = 78px) the game allocates 8x15 field (=134px), which is almost twice wider than it should be.
      And, as you can see on the screenshot, only 26 symbols was put in a line instead of 41. Ye, to compare the fonts there was set English language, so you see the original ASCII latin font there.

      How to reproduce:
      1) Download and activate the attached resource pack.
      2) Restart the game (otherwise the glyph_sizes.bin won't be loaded from the respack).
      3) Enable "Force Unicode" option (or set Bulgarian/Russian/Serbian language).

      Suggestion how to fix:
      In 1.6 and 1.7 (and I believe it's still goes the same way in 1.8, but I can't assert it as I haven't seen its code yet), the problem was in the FontRenderer class, precisely in these two lines:
      ...
      } else if (this.glyphWidth[ symbol ] != 0)

      { int start = this.glyphWidth[ symbol ] >>> 4; int stop = this.glyphWidth[ symbol ] & 15; // === THESE TWO LINES: === if(stop > 7) { stop = 15; start = 0; }

      // =============
      stop += 1;
      return (stop - start) / 2 + 1;
      } else {
      ...

      As it's still wasn't removed, I believe it fixes widths of some hieroglyphs, but obviously it should be isolated from latin and cyrillic charsets. (You know better how it works, so I think you'd found a good way to do it).

      PS: Yes, it is a repost of MC-23952 which was marked as resolved, but it wasn't solved in fact.

      PPS: As the whole thing with font changing is mostly workaround for not-yet-implemented feature, you may ask, why the hell I'm posting it as a bug. Because the font changing wasn't implemented for more than year, I think. And the original unicode font is quite... not perfect. To be honest, today Minecraft just looks like a game, which is released and overstuffed with various features, but still has pre-alpha-stage fonts, and it makes a really irritative dissonance in players' mind.

        1. 01 - default.png
          01 - default.png
          25 kB
        2. 02 - with wide font.png
          02 - with wide font.png
          27 kB
        3. 03 - with wide font.png
          03 - with wide font.png
          203 kB
        4. 04 - with wide font.png
          04 - with wide font.png
          55 kB
        5. glyph_sizes_lat.png
          glyph_sizes_lat.png
          21 kB
        6. glyph_sizes_rus.png
          glyph_sizes_rus.png
          20 kB
        7. screen_chat.png
          screen_chat.png
          256 kB
        8. screen_settings.png
          screen_settings.png
          82 kB
        9. widefontbug18.zip
          14 kB

            Unassigned Unassigned
            Hy60koshk Vsevolod
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:
              CHK: