harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ilya Okomin (JIRA)" <j...@apache.org>
Subject [jira] Created: (HARMONY-2348) [classlib][awt] java.awt.Font constructors on Harmony treat name parameter as a family name only.
Date Tue, 28 Nov 2006 13:58:21 GMT
[classlib][awt] java.awt.Font constructors on Harmony treat name parameter as a family name

                 Key: HARMONY-2348
                 URL: http://issues.apache.org/jira/browse/HARMONY-2348
             Project: Harmony
          Issue Type: Bug
          Components: Classlib
            Reporter: Ilya Okomin
            Priority: Minor

Spec says "The font name can be a font face name or a font family name. It is used together
with the style to find an appropriate font face." however Harmony uses font name parameter
as family name only with applying style parameter to init Font object.
Next test case shows the difference between RI and Harmony:

----------- Bug.java ----------
import java.awt.Font;

import junit.framework.TestCase;
import junit.textui.TestRunner;

public class Bug extends TestCase {

    final String FAMILY_NAME = "Times New Roman";
    final String FACE_NAME = "Times New Roman Italic";

    public void testFontFromFace() throws Exception {
        final int FONT_SIZE = 12;
        Font fnt = new Font(FACE_NAME, Font.PLAIN, FONT_SIZE);
        assertEquals(FAMILY_NAME, fnt.getFamily());

    public static void main(String[] args){
===== Output on RI ======
Time: 1,282

OK (1 test)

===== Output on Harmony ======
Time: 0.691
There was 1 failure:
1) testFontFromFace(Bug)junit.framework.ComparisonFailure: expected:<Times New Roman>
but was:<Default>
	at Bug.testFontFromFace(Bug.java:14)
	at java.lang.reflect.VMReflection.invokeMethod(Native Method)
	at Bug.main(Bug.java:18)

Tests run: 1,  Failures: 1,  Errors: 0

On the current implementation, when Harmony gets name parameter it is trying to find out if
appropriate family name exist in the list of available families, if it is missed (e.g. case
when name parameter  is a face name) it creates Default font. Creating Fonts from  face names
support should be added to the Harmony.

This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira


View raw message