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

Support fonts installed per-user on Windows 10

    XMLWordPrintable

    Details

    • Subcomponent:
      2d
    • CPU:
      x86_64
    • OS:
      windows_10

      Description

      ADDITIONAL SYSTEM INFORMATION :
      Windows 10, Java 11

      A DESCRIPTION OF THE PROBLEM :
      Starting from build 17704, Windows 10 supports per-user font installation (see https://blogs.windows.com/windowsexperience/2018/06/27/announcing-windows-10-insider-preview-build-17704/#SgtQaWxPhRKl3mHR.97). This installation method actually becomes default, while 'Install for all users' action does it now the old (system-wide) way.
      JRE currently doesn't recognize fonts installed in the new way. In particular, GraphicsEnvironment.getAllFonts() doesn't list them, and such fonts cannot be used by passing their name to Font constructor.

      This issue was reported and fixed for Java 13, but it is not fixed in Java 11. We're reporting this issue to have the fix in Java 13 backported to Java 11.

      Java 11 is an LTS version, so we think this fix should be included with Java 11.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Install a font in a version of Windows 10 newer than build 17704. Get all fonts from the GraphicsEnvironment and print each font's font.getName() and font.getLocalName().
      Note that for the font just installed, in the user's home folder, getLocalName() return "Dialog.plain", which indicates that Java did not load the font.
      Any text drawn using this font will use the Dialog.plain font, not the actual font.


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The font should be loaded and text drawn with the font should use the font.
      ACTUAL -
      The font is not loaded and any text drawn using this font will use the Dialog.plain font, not the actual font.

      ---------- BEGIN SOURCE ----------
      public class TestFonts
      {
      public static void main(String [] args) throws Exception
      {
      GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
      Font[] pcFonts = ge.getAllFonts();

      for (Font f : pcFonts)
      {
      if (f.getName().equalsIgnoreCase(f.getFontName()) == false)
      {
      System.out.println(f.getName() + " :: " + f.getFontName());
      }
      }
      }
      }
      ---------- END SOURCE ----------

      FREQUENCY : always


        Attachments

          Issue Links

            Activity

              People

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

                Dates

                Created:
                Updated: