Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

corretto8 crashes with anything that sniffs fonts #3859

Open
themightychris opened this issue May 5, 2021 · 0 comments
Open

corretto8 crashes with anything that sniffs fonts #3859

themightychris opened this issue May 5, 2021 · 0 comments

Comments

@themightychris
Copy link
Contributor

themightychris commented May 5, 2021

core/jre8 comes with a fontconfig.properties and fonts/ directory under $(hab pkg path core/jre8)/lib

core/corretto8 is missing such assets though, the following minimal test case fails:

$ cat << EOF > Fonts.java
import java.awt.GraphicsEnvironment;

public class Fonts {
    public static void main(String... args) {
        String[] fonts = GraphicsEnvironment
                .getLocalGraphicsEnvironment()
                .getAvailableFontFamilyNames();

        for (String font : fonts) {
            System.out.println(font);
        }
    }
}
EOF

$ hab pkg install core/corretto8

$ hab pkg exec core/corretto8 javac Fonts.java

$ hab pkg exec core/corretto8 java Fonts
Exception in thread "main" java.lang.NullPointerException
        at sun.awt.FontConfiguration.getVersion(FontConfiguration.java:1264)
        at sun.awt.FontConfiguration.readFontConfigFile(FontConfiguration.java:219)
        at sun.awt.FontConfiguration.init(FontConfiguration.java:107)
        at sun.awt.X11FontManager.createFontConfiguration(X11FontManager.java:774)
        at sun.font.SunFontManager$2.run(SunFontManager.java:431)
        at java.security.AccessController.doPrivileged(Native Method)
        at sun.font.SunFontManager.<init>(SunFontManager.java:376)
        at sun.awt.FcFontManager.<init>(FcFontManager.java:35)
        at sun.awt.X11FontManager.<init>(X11FontManager.java:57)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
        at java.lang.Class.newInstance(Class.java:442)
        at sun.font.FontManagerFactory$1.run(FontManagerFactory.java:83)
        at java.security.AccessController.doPrivileged(Native Method)
        at sun.font.FontManagerFactory.getInstance(FontManagerFactory.java:74)
        at sun.java2d.SunGraphicsEnvironment.getFontManagerForSGE(SunGraphicsEnvironment.java:190)
        at sun.java2d.SunGraphicsEnvironment.getAvailableFontFamilyNames(SunGraphicsEnvironment.java:224)
        at sun.java2d.SunGraphicsEnvironment.getAvailableFontFamilyNames(SunGraphicsEnvironment.java:252)
        at sun.java2d.HeadlessGraphicsEnvironment.getAvailableFontFamilyNames(HeadlessGraphicsEnvironment.java:94)
        at Fonts.main(Fonts.java:7)

Copying the assets from jre8 makes it work:

$ hab pkg install core/jre8

$ cp -r $(hab pkg path core/jre8)/lib/font* $(hab pkg path core/corretto8)/jre/lib/

$ hab pkg exec core/corretto8 java Fonts
Dialog
DialogInput
Lucida Bright
Lucida Sans
Lucida Sans Typewriter
Monospaced
SansSerif
Serif

I'm lost at how to approach a proper fix. core/liberation-fonts-ttf seems to provide some fonts in the Habitat package ecosystem, but I can't make heads or tails of the fontconfig.properties file that seems to configure available fonts

See also: corretto/corretto-8#64

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant