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

TrueType Fonts which have only Apple platform names cannot be loaded

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 6.0, 5.0, 7, 8, 9
    • Fix Version/s: 9
    • Component/s: client-libs
    • Labels:
    • Subcomponent:
      2d
    • Resolved In Build:
      b155
    • CPU:
      x86
    • OS:
      windows_xp

      Backports

        Description

        FULL PRODUCT VERSION :
        1.5.0_01-b08

        ADDITIONAL OS VERSION INFORMATION :
        Windows XP SP2

        A DESCRIPTION OF THE PROBLEM :
        In Java 1.4 and earlier it was possible to load TrueType fonts with the java.awt.Font.createFont() method that contained only an apple cmap (platform 1, encoding 0). Ditto for reading the the names table.

        Now, in 1.5, the sun.font.TrueType class specifically checks for the platform ID of the *first* CMAP table and if it's not 3, aborts.

        Most fonts have several cmap tables - the one we're testing has 1/0 for the first table, and the expected 3/1 for the second table. The correct behaviour is to scan all the cmap tables looking for a 3/1 table. It should also accept a 1/0 table as backup, as there is a well-defined mapping from Apples Roman encoding to Unicode. In fact one of your engineers says that it did just that back in 1.3.1 - see bug 4517869.

        Second problem, same as the first. The "name" table is required to have a name in Microsofts Unicode encoding, or it won't load. Again it should accept a font with Apple encodings.

        I know most fonts these days have MS format name tables, but that's not the point - the most important aspect of this is that it worked in 1.4 and doesn't now.
         

        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        Given any font where the first CMAP does not have platform=3, encoding=1, and/or a NAME table that doesn't contain any names with platform=3, encoding=1:

        Font.createFont(Font.TRUETYPE, fontfileinputstream);

        dies with "No font or font-family name". The message is similar for the CMAP table.

        EXPECTED VERSUS ACTUAL BEHAVIOR :
        EXPECTED -
        Font should load correctly as for 1.4.2

        REPRODUCIBILITY :
        This bug can be reproduced always.

        CUSTOMER SUBMITTED WORKAROUND :
        Hmph. We edited the font with a hex editor to set the first CMAP to "3/0" and the entries in the names table to "3/0". Not really a solution.
        ###@###.### 2005-2-23 18:00:21 GMT

          Attachments

            Issue Links

              Activity

                People

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

                  Dates

                  Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: