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

[freetype] text rotated on 180 degrees is too narrow

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 11
    • Fix Version/s: 11
    • Component/s: client-libs
    • Labels:
      None
    • Subcomponent:
      2d
    • Resolved In Build:
      b17
    • CPU:
      generic
    • OS:
      generic

      Backports

        Description

        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.

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                bae Andrew Brygin
                Reporter:
                bae Andrew Brygin
                Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved: