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

java.awt.Font needs to understand OpenType fonts, or at least also TYPE2

    Details

    • Type: Enhancement
    • Status: Closed
    • Priority: P4
    • Resolution: Duplicate
    • Affects Version/s: 6u22
    • Fix Version/s: None
    • Component/s: client-libs
    • Labels:
    • Subcomponent:
      2d
    • CPU:
      x86
    • OS:
      windows_2008

      Description

      A DESCRIPTION OF THE REQUEST :
      java.awt.Font currently only supports TrueType and Type1 formats. Neither of these formats are current anymore: TrueType is now OpenType-with-truetype-outlines, Type1 are an extinct format, with Adobe having moved on to OpenType-with-type2-oulines.

      Given that this class is used by AWT and Swing for all typography, it is unacceptable that it does not support TYPE2, a format that has been widely used in commercial fonts for over a decade.

      JUSTIFICATION :
      It's 2010.

      OpenType has established itself as de facto font technology after continued effort by Microsoft, Adobe and Apple, and the work payed off -- we finally have a proper unified font technology. Even LaTeX (in the form of XeTeX, LuaTeX and ConTeXt) now supports Unicode and OpenType.

      Java has fallen behind. Its String class does not properly support Unicode 4 and higher and its Font class does not properly support OpenType.

      At the very least, Font needs to be able to deal with OpenType fonts that use CFF/Type2 blocks. All modern Adobe fonts use this format today (in fact, Adobe had all its font updated to this format and no longer sells or supplies Type1 fonts), and for large Unicode fonts this format is preferred, as it packs its data more efficiently than TrueType fonts.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      I would like to see java.awt.Font have a constructor that does not need a type indicator, in addition to the currently existing constructors, that load an .otf or .ttf file and autodetect what they need to load, because that's what the opentype wrapper allows. The sfnt version, the first four bytes in the file, unambiguously indicate which font type is being loaded. This doesn't even require FreeType.

      new Font(new File("myfont.otf")) should be sufficient.

      Barring that, at the very least java.awt.Font needs a TYPE2 constant so that cff/type2 fonts can explicitly be loaded

      new Font(Font.TYPE2, new File("myfont.otf"));

      The best solution is probably to offer both, because the first is trivial (find the first 4 bytes, determine the font type, then call this(type, resource))
      ACTUAL -
      java.awt.Font does not support OpenType, nor TYPE2.

      CUSTOMER SUBMITTED WORKAROUND :
      There is no workaround. AWT and Swing rely on java.awt.Font. As long as it does not support OpenType, but only supports TrueType and the obsolete Type1, java's typographical capabilities are archaic.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                prr Philip Race
                Reporter:
                webbuggrp Webbug Group
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: