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] Commented: (HARMONY-2348) [classlib][awt] java.awt.Font constructors on Harmony treat name parameter as a family name only.
Date Wed, 06 Dec 2006 12:37:22 GMT
    [ http://issues.apache.org/jira/browse/HARMONY-2348?page=comments#action_12455984 ] 
Ilya Okomin commented on HARMONY-2348:

I want to add some investigation about the logical fonts.
According to the RI behavior, fonts also can be created using logical font face names. The
format of the logical font face name isn't described in the spec but it looks like %family%.%style%,
e.g. "dialog.bold" or "dialoginput.bolditalic". 
Such font face names should be returned as results of Font.getFontName() calls. E.g. if font
was created in this way "Font font = new Font("dialog", Font.BOLD, 12)", then font.getFontName()
should return "Dialog.bold" face name.


> [classlib][awt] java.awt.Font constructors on Harmony treat name parameter as a family
name only.
> -------------------------------------------------------------------------------------------------
>                 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){
>         TestRunner.run(Bug.class);
>     }
> }
> --------------------------------------------
> ===== 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