Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6456316

REGRESSION:Problem with creating large Fonts

XMLWordPrintable

    • 2d
    • b33
    • 6
    • b96
    • x86
    • windows_xp

      With Java 1.6 there is a regression with creating large fonts. If we want
      create a font with a size of 4400 then we receive only a font with a default
      font size of 12. We need this large fonts because we work with scaled
      graphics for printing.
       
      Attached the follow simple test program to show the problem:
      =================================================
      import java.awt.Font;
      import java.awt.font.TextAttribute;
      import java.util.Hashtable;
       
      public class FontTest {
       
          public static void main(String[] args) {
              System.out.println("Java
      Version:\t"+System.getProperty("java.vm.version"));
              Font font = getFloatingFont( "SansSerif", 0, 4400);
              System.out.println("Font Size:\t"+font.getSize2D());
          }
       
          
          final private static Font getFloatingFont( String name, int style, int
      sizeTwips ) {
              Hashtable attributes = new Hashtable();
              attributes.put(TextAttribute.SIZE, new
      java.lang.Float((sizeTwips)));
              attributes.put(TextAttribute.FAMILY, name );
              
              if((style & 1) > 0) {
                  attributes.put(TextAttribute.WEIGHT,TextAttribute.WEIGHT_BOLD);
              }
              if((style & 2) > 0) {
       
      attributes.put(TextAttribute.POSTURE,TextAttribute.POSTURE_OBLIQUE);
              }
              if ((style & 4) > 0) {
       
      attributes.put(TextAttribute.UNDERLINE,TextAttribute.UNDERLINE_ON);
              }
              if ((style & 8) > 0) {
       
      attributes.put(TextAttribute.STRIKETHROUGH,TextAttribute.STRIKETHROUGH_ON);
              }
              
              Font font = new Font(attributes);
              
              return font;
          }
      }
      =====================================================
       
      This test program produce the follow different output for the different Java
      VMs:
      =========
      Java Version: 1.4.2_03-b02
      Font Size: 4400.0
      =========
      Java Version: 1.5.0_04-b05
      Font Size: 4400.0
      ========
      Java Version: 1.6.0-rc-b92
      Font Size: 12.0
      ========

            igor Igor Nekrestyanov (Inactive)
            tyao Ting-Yun Ingrid Yao (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: