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

Add a possibility to obtain FontMetrics object directly from Font and FontRenderContext

XMLWordPrintable

    • 2d
    • x86
    • other

      A DESCRIPTION OF THE REQUEST :
      Currently public API allows to obtain FontMetrics instance only from Graphics object or from a Component instance. In some cases it's more convenient to be able to construct it from Font and required FontRenderContext. This would allow to perform text layout tasks when related component is not painting, and not even part of component hierarchy yet. Potential recalculation of text layout would still be required when component becomes shown, if FontRenderContext will change (e.g. if component is shown on a different monitor), but such events must be quite rare.

      JUSTIFICATION :
      sun.font.FontDesignMetrics.getMetrics(Font, FontRenderContext) method provides a solution, but it's not in public API, and will not be available in Java 9.


            prr Philip Race
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated: