JDK-4807159 : RFE: Bad implementation of constructor FontUIResource(Font font)
  • Type: Enhancement
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 1.4.1
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2003-01-23
  • Updated: 2006-09-19
  • Resolved: 2006-09-19
Related Reports
Duplicate :  
Description
Name: jk109818			Date: 01/23/2003


FULL PRODUCT VERSION :
build 1.4.1_01-b01

A DESCRIPTION OF THE PROBLEM :
the constructor FontUIResource(Font font), doesn't return
a FontUIResource equivalent to the font used.

The implementation of the constructor is
public FontUIResource(Font font) {
  super(font.getName(), font.getStyle(), font.getSize());
}

but you lose lot of info like AffineTransform used in
font object.

a better implementation will be
public FontUIResource(Font font) {
  super(font.getAttributes());
}

if this is not possible to modify this implementation, at
least then add the constructor:

  Public FontUIResource(Map attributes)

otherwise not every font could be used in the MetalTheme
for example.


REPRODUCIBILITY :
This bug can be reproduced always.
(Review ID: 180313) 
======================================================================

Comments
EVALUATION This was fixed in JDK 6 as 6313541: Fonts loaded with createFont cannot be converted into FontUIResource Now the implementation looks like public FontUIResource(Font font) { super(font); } which calls a new Font() constructor which copies all the info from the original font
19-09-2006