bug-classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug awt/30106] New: JDK-1.0-style logical font names


From: hendrich at informatik dot uni-hamburg dot de
Subject: [Bug awt/30106] New: JDK-1.0-style logical font names
Date: 7 Dec 2006 09:14:08 -0000

Current JDKs still support the original logical font names used
in JDK 1.0, namely:

old              current
"TimesRoman"     "Serif"
"Helvetica"      "SansSerif"
"Courier"        "Monospaced"

Current classpath cvs ignores those names and returns Dialog as
the default font. I have an app here that still uses the old names.
See attached testcase for a demo.

A simple change to ClassPathFontPeer would be enough to make
classpath compatible with the JDK, at the cost of slightly
less elegance:

gnu/java/awt/peer/ClasspathFontPeer.java:

 protected static boolean isLogicalFontName(String name)
  {
    String uname = name.toUpperCase ();
    return (uname.equals ("SANSSERIF") ||
            uname.equals ("SERIF") ||
            uname.equals ("MONOSPACED") ||
            uname.equals ("DIALOG") ||
            uname.equals ("DIALOGINPUT") ||

            uname.equals ("TIMESROMAN") ||   // JDK 1.0 style names are
            uname.equals ("COURIER") ||      // still sometimes used

            uname.equals ("DEFAULT"));
  }

  protected static String logicalFontNameToFaceName (String name)
  {
    String uname = name.toUpperCase ();
    if (uname.equals("SANSSERIF"))
      return "Helvetica";
    else if (uname.equals ("SERIF"))
      return "Times";
    else if (uname.equals ("MONOSPACED"))
      return "Courier";
    else if (uname.equals ("DIALOG"))
      return "Helvetica";
    else if (uname.equals ("DIALOGINPUT"))
      return "Helvetica";
    else if (uname.equals ("DEFAULT"))
      return "Dialog.plain";

    else if (uname.equals ("TIMESROMAN"))    // JDK 1.0 style
      return "Times";
    else if (uname.equals ("COURIER"))
      return "Courier";

    else
      return "Helvetica";
  }


Could somebody please review this and check this in if found ok?


-- 
           Summary: JDK-1.0-style logical font names
           Product: classpath
           Version: 0.93
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: awt
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: hendrich at informatik dot uni-hamburg dot de


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30106





reply via email to

[Prev in Thread] Current Thread [Next in Thread]