United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
JDK-4892367 : Spec clarification: java.awt.GraphicsEnvironment.getAvailableFontFamilyNames()

Details
Type:
Bug
Submit Date:
2003-07-17
Status:
Resolved
Updated Date:
2003-08-11
Project Name:
JDK
Resolved Date:
2003-08-11
Component:
client-libs
OS:
generic
Sub-Component:
2d
CPU:
generic
Priority:
P3
Resolution:
Fixed
Affected Versions:
5.0
Fixed Versions:
5.0 (tiger)

Related Reports

Sub Tasks

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


                                     
2004-06-14
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
============================
                                     
2003-07-17
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
=============================
                                     
2003-07-17



Hardware and Software, Engineered to Work Together