-
Enhancement
-
Resolution: Unresolved
-
P4
-
9
-
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.
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.