-
Bug
-
Resolution: Fixed
-
P3
-
9
-
b127
-
x86
-
other
A DESCRIPTION OF THE REQUEST :
SwingUtilities2 provides a number of methods and fields related to drawing and measuring text. These methods and fields are widely used in platform LAFs. They support text anti-aliasing and compatibility of rendering for printing and display. This functionality should be provided in a public API for use by third party LAFs in JDK9 and beyond.
The relevant methods and fields are:
drawString(JComponent, Graphics, String, int, int)
drawStringUnderlineCharAt
clipStringIfNecessary
stringWidth
getFontMetrics(JComponent, Graphics)
AATextInfo.getAATextInfo
AA_TEXT_PROPERTY_KEY
These methods and fields support anti-aliasing features that perhaps could be duplicated using public APIs, but it would be a lot of work.
These methods also use private APIs to obtain a Graphics2D from the Graphics object used in the printing APIs, so that text rendering when printing can be the same as on a display.
The Aqua LAF does something similar with printer graphics in AquaPainter.getGraphics2D. The fact that it is not exactly the same should be investigated.
These symbols are less widely used but should also be considered:
COMPONENT_UI_PROPERTY_KEY
BASICMENUITEMUI_MAX_TEXT_OFFSET
This RFE should be have labels "modularization" and "jdkinternals".
JUSTIFICATION :
It should be possible to write custom LAFs that have the same abilities as platform LAFs. In JDK9, the internal APIs used by platform LAFs will no longer be available outside the JDK. Hence, public APIs are needed.
SwingUtilities2 provides a number of methods and fields related to drawing and measuring text. These methods and fields are widely used in platform LAFs. They support text anti-aliasing and compatibility of rendering for printing and display. This functionality should be provided in a public API for use by third party LAFs in JDK9 and beyond.
The relevant methods and fields are:
drawString(JComponent, Graphics, String, int, int)
drawStringUnderlineCharAt
clipStringIfNecessary
stringWidth
getFontMetrics(JComponent, Graphics)
AATextInfo.getAATextInfo
AA_TEXT_PROPERTY_KEY
These methods and fields support anti-aliasing features that perhaps could be duplicated using public APIs, but it would be a lot of work.
These methods also use private APIs to obtain a Graphics2D from the Graphics object used in the printing APIs, so that text rendering when printing can be the same as on a display.
The Aqua LAF does something similar with printer graphics in AquaPainter.getGraphics2D. The fact that it is not exactly the same should be investigated.
These symbols are less widely used but should also be considered:
COMPONENT_UI_PROPERTY_KEY
BASICMENUITEMUI_MAX_TEXT_OFFSET
This RFE should be have labels "modularization" and "jdkinternals".
JUSTIFICATION :
It should be possible to write custom LAFs that have the same abilities as platform LAFs. In JDK9, the internal APIs used by platform LAFs will no longer be available outside the JDK. Hence, public APIs are needed.
- relates to
-
JDK-8168992 Add floating point implementation for new BasicGraphicsUtils text related methods use floating point API
-
- Resolved
-
-
JDK-8153662 SwingUtilities2.drawString()/getStringWidth()/clipString() should use more text attributes
-
- Closed
-
-
JDK-8156217 Selected text is shifted on HiDPI display
-
- Resolved
-
-
JDK-8212904 JTextArea line wrapping incorrect when using UI scale
-
- Resolved
-
-
JDK-8169897 [PIT] javax/swing/plaf/basic/BasicGraphicsUtils/8132119/bug8132119.java fails
-
- Resolved
-
-
JDK-4339584 Adding a getUI public method to JComponent
-
- Resolved
-
(1 relates to)