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

Linked font broken on the Mac

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 7u6
    • Fix Version/s: 7u6
    • Component/s: javafx
    • Labels:

      Description

      While testing complex text I came across a serious problem:

      In the FallbackResources, for Mac, the paths for the file fonts are mixed of paths and URL, see T2KFontFactory#getLinkedFonts()
      if (isMacOSX) {
          // Hotkey implementation of fallback font on Mac
          fontRegInfo[0].add("file:///Library/Fonts/Arial%20Unicode.ttf");
          fontRegInfo[1].add("Arial Unicode MS");
          
          // Add Lucida Sans Regular to Mac OS X fallback list
          fontRegInfo[0].add(jreFontDir + jreDefaultFontFile);
          fontRegInfo[1].add(jreDefaultFont);
                      
          // Add Apple Symbols to Mac OS X fallback list
          fontRegInfo[0].add("file:///System/Library/Fonts/Apple%20Symbols.ttf");
          fontRegInfo[1].add("Apple Symbols");
          
          return fontRegInfo;
      }

      Note that the first and last are URL, the second is path.

      Try to use this text+font in a Text node:
      Text node = new Text("\u0625\u0626 \u0627\u0628");
      node.setFont("System", 36);

      running with -Dprism.debugfonts=true I get the exception:
      java.io.FileNotFoundException: Unable to create FontResource for file file:///Library/Fonts/Arial%20Unicode.ttf
      at com.sun.t2k.T2KFontFile.init(T2KFontFile.java:539)
      at com.sun.t2k.T2KFontFile.<init>(T2KFontFile.java:186)
      at com.sun.t2k.T2KFontFile.createFontResource(T2KFontFile.java:112)
      at com.sun.t2k.T2KFontFile.createFontResource(T2KFontFile.java:174)
      at com.sun.t2k.T2KFontFile.createFontResource(T2KFontFile.java:127)
      at com.sun.t2k.T2KFontFactory.getFontResource(T2KFontFactory.java:438)
      at com.sun.t2k.FallbackResource.getSlotResource(FallbackResource.java:195)
      at com.sun.t2k.T2KCompositeFontResource.getSlotResource(T2KCompositeFontResource.java:53)


      that is because createFontResource expects to be called with a path not a URL.

      Either, this has be broken for a long time (which is bad), and surprising since we touched this code recently with RT-20718.
      Or I broke it implementing dfont/woff (but as far as I can tell this has being broken before me).


        Attachments

          Activity

            People

            • Assignee:
              fheidric Felipe Heidrich (Inactive)
              Reporter:
              fheidric Felipe Heidrich (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Imported: