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

Systems with no fonts it should still be possible to create Fonts from data

XMLWordPrintable

    • 2d
    • x86_64
    • linux

      ADDITIONAL SYSTEM INFORMATION :
      Linux (Technically I expect it to affect any OS with varying Exceptions, but Linux there are real cases)

      A DESCRIPTION OF THE PROBLEM :
      On systems with no fonts installed creating and using AWT Fonts (from files or streams) causes an exception (see first stack trace in Actual Result). It would be preferable if those Exceptions would not happen, at least not until it is necessary, e.g. when the non-existing default-physical-font is required.

      If this is too much of a change in behavior, making it configurable, e.g. via the command-line, would also work, but changed default behavior would be ideal.

      On Linux there is also an Exception (second stack trace in Actual Result) when fontconfig is missing. that should ideally also be changed in the same way.

      ACTUAL -
      java.lang.Error: Probable fatal error: No physical fonts found.
      at java.desktop/sun.font.SunFontManager.lambda$getDefaultPhysicalFont$0(Unknown Source)
      at java.desktop/sun.font.SunFontManager$$Lambda$823/0000000000000000.get(Unknown Source)
      at java.base/java.util.Optional.orElseThrow(Unknown Source)
      at java.desktop/sun.font.SunFontManager.getDefaultPhysicalFont(Unknown Source)
      at java.desktop/sun.font.CompositeFont.doDeferredInitialisation(Unknown Source)
      at java.desktop/sun.font.CompositeFont.getSlotFont(Unknown Source)
      at java.desktop/sun.font.CompositeStrike.getStrikeForSlot(Unknown Source)
      at java.desktop/sun.font.CompositeStrike.getFontMetrics(Unknown Source)
      at java.desktop/sun.font.Font2D.getFontMetrics(Unknown Source)
      at java.desktop/java.awt.Font.defaultLineMetrics(Unknown Source)
      at java.desktop/java.awt.Font.getLineMetrics(Unknown Source)


      java.lang.NullPointerException
      at java.desktop/sun.awt.FontConfiguration.getVersion(Unknown Source)
      at java.desktop/sun.awt.FontConfiguration.readFontConfigFile(Unknown Source)
      at java.desktop/sun.awt.FontConfiguration.init(Unknown Source)
      at java.desktop/sun.awt.X11FontManager.createFontConfiguration(Unknown Source)
      at java.desktop/sun.font.SunFontManager$2.run(Unknown Source)
      at java.base/java.security.AccessController.doPrivileged(Unknown Source)
      at java.desktop/sun.font.SunFontManager.<init>(Unknown Source)
      at java.desktop/sun.awt.FcFontManager.<init>(Unknown Source)
      at java.desktop/sun.awt.X11FontManager.<init>(Unknown Source)
      at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
      at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
      at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Unknown Source)
      at java.base/java.lang.reflect.Constructor.newInstance(Unknown Source)
      at java.desktop/sun.font.FontManagerFactory$1.run(Unknown Source)
      at java.base/java.security.AccessController.doPrivileged(Unknown Source)
      at java.desktop/sun.font.FontManagerFactory.getInstance(Unknown Source)
      at java.desktop/java.awt.Font.getFont2D(Unknown Source)
      at java.desktop/java.awt.Font.defaultLineMetrics(Unknown Source)
      at java.desktop/java.awt.Font.getLineMetrics(Unknown Source)

      FREQUENCY : always


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

              Created:
              Updated:
              Resolved: