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

REGRESSION: Font.decode() doesn't recognize PLAIN style

XMLWordPrintable

    • 2d
    • b57
    • x86
    • windows_xp



      Name: pr15447 Date: 06/07/2004


      FULL PRODUCT VERSION :
      java version "1.5.0-beta2"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta2-b51)
      Java HotSpot(TM) Client VM (build 1.5.0-beta2-b51, mixed mode, sharing)

      A DESCRIPTION OF THE PROBLEM :
      This code:

        System.out.println(Font.decode("monospaced-plain-14"));

      yields this output:

        java.awt.Font[family=Dialog,name=monospaced-plain,style=plain,size=14]


      The problem is with these lines from the decode() method:

      if (styleName.equals("bolditalic")) {
      fontStyle = Font.BOLD | Font.ITALIC;
      } else if (styleName.equals("italic")) {
      fontStyle = Font.ITALIC;
      } else if (styleName.equals("bold")) {
      fontStyle = Font.BOLD;
      } else {
      /* this string isn't any of the expected styles, so
      * assume its part of the font name
      */
      styleIndex = sizeIndex;
      if (str.charAt(styleIndex-1) == sepChar) {
      styleIndex--;
      }
      }

      If no style is specified, it defaults to plain, but if "plain" is specified,
      it's treated as part of the family name.

      REGRESSION. Last worked in version tiger-beta1


      REPRODUCIBILITY :
      This bug can be reproduced always.

      CUSTOMER SUBMITTED WORKAROUND :
      Instead, e.g., of "monospaced-plain-14", use "monospaced-14" and let the style
      default to "plain".

      Release Regression From : 1.4.2
      The above release value was the last known release where this
      bug was known to work. Since then there has been a regression.

      (Incident Review ID: 275520)
      ======================================================================

            prr Philip Race
            prr Philip Race
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: