JDK-4892367 : Spec clarification: java.awt.GraphicsEnvironment.getAvailableFontFamilyNames()
  • Type: Bug
  • Component: client-libs
  • Sub-Component: 2d
  • Affected Version: 5.0
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2003-07-17
  • Updated: 2017-05-16
  • Resolved: 2003-08-11
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
5.0 tigerFixed
Description
The methods
java.awt.GraphicsEnvironment.getAvailableFontFamilyNames()
and
java.awt.GraphicsEnvironment.getAvailableFontFamilyNames(Locale)


have specifications which are open to misinterpretation
This is highlighted by a  new JCK test which attempts to interpret the
which is justified neither by the specification nor the implementation.

We should clarify the specification such that it reflects what has always
been implemented.

Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: tiger FIXED IN: tiger INTEGRATED IN: tiger tiger-b15
14-06-2004

SUGGESTED FIX Revise the spec as follows. /** * Returns an array containing the names of all font families in this * <code>GraphicsEnvironment localized for the default locale</code>, * as returned by <code>Locale.getDefault()</code>. * * Typical usage would be for presentation to a user for selection of * a particular family name. An application can then specify this name * when creating a font, in conjunction with a style, such as bold or * italic, giving the font system flexibility in choosing its own best * match among multiple fonts in the same font family. * * @return an array of <code>String</code> containing font family names * localized for the default locale, or a suitable alternative * name if no name exists for this locale. * @see #getAllFonts * @see java.awt.Font * @see java.awt.Font#getFamily * @since 1.2 */ public abstract String[] getAvailableFontFamilyNames(); /** * Returns an array containing the names of all font families in this * <code>GraphicsEnvironment</code> localized for the specified locale. * <p> * Typical usage would be for presentation to a user for selection of * a particular family name. An application can then specify this name * when creating a font, in conjunction with a style, such as bold or * italic, giving the font system flexibility in choosing its own best * match among multiple fonts in the same font family. * * @param l a {@link Locale} object that represents a * particular geographical, political, or cultural region. * Specifying <code>l</code> as <code>null</code> is equivalent to * specifying <code>Locale.getDefault()</code> * @return an array of <code>String</code> containing font family names * localized for the specified <code>Locale</code>, or a * suitable alternative name if no name exists for the specified locale. * @see #getAllFonts * @see java.awt.Font * @see java.awt.Font#getFamily * @since 1.2 */ public abstract String[] getAvailableFontFamilyNames(Locale l); ###@###.### 2003-07-17 ============================
17-07-2003

EVALUATION There is potential for confusion over - whether the method that takes a Locale returns just font families that support a locale - whether the no-args methods returns "a" name for every font family or all localized names of all font families The utility of either of these is questionable and neither is what is implemented. ###@###.### 2003-07-17 =============================
17-07-2003