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

Returned FontMetrics are incorrect in a scaled context

    XMLWordPrintable

Details

    • Enhancement
    • Resolution: Unresolved
    • P4
    • tbd
    • None
    • client-libs

    Description

      There are lots of places internally in Swing's painting code that uses
      JComponent.getFontMetrics() (which in turn uses SwingUtilities2.getFontMetrics())
      to determine the bounds of some text. In an environment where the Swing application
      is scaled (i.e. a scale factor is applied to the Graphics2D used in paintComponent())
      these metrics are incorrect because the aforementioned methods are using an
      unscaled FontRenderContext. We need to either use the FRC from the Graphics used
      for painting (by calling g.getFontRenderContext() on a scaled Graphics object) or
      we need to manually construct an FRC that is scaled according the the current
      Swing scale factor (see 6486815).
      testcase attached

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              campbell Christopher Campbell (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Imported:
                Indexed: