Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8203485

[freetype] text rotated on 180 degrees is too narrow

XMLWordPrintable

    • 2d
    • b17
    • generic
    • generic

        With freetype, text rotated on 180 or 270 degrees is too narrow.
        Attached test case and screen shoots demonstrate the problem.

        The problem is caused by the rounding applied to the cases of vertical
        and horizontal text, see freetypeScaler.c, lines 768 and 773:
        http://hg.openjdk.java.net/jdk/client/file/80a5ff734fcd/src/java.desktop/share/native/libfontmanager/freetypeScaler.c#l768
        http://hg.openjdk.java.net/jdk/client/file/80a5ff734fcd/src/java.desktop/share/native/libfontmanager/freetypeScaler.c#l773

        The rounding routine is defined as ROUND(x) ((int) (x+0.5)) (see line 48),
        and it gives incorrect results for negative arguments.

        For example, say glyph advance is 8, and we render it without rotation, and with rotation on 180 degrees. In these cases, ROUND(8)=8, whereas ROUND(-8)=-7.

        It is not clear, why do we need the rounding for vertical and horizontal text,
        but if we do, then the rounding routine should handle negative arguments
        in a more accurate manner.

        The problem affects EA builds of JDK 11, and any openjdk builds.

              bae Andrew Brygin
              bae Andrew Brygin
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated:
                Resolved: