在运行corretto的lambda中指定字体位置

uyto3xhc  于 2021-08-25  发布在  Java
关注(0)|答案(0)|浏览(317)

有人知道如何在corretto 8下运行的aws lambda中配置字体位置吗?amz linux 2没有任何字体库或字体。通过将缺少的libs和fontconfig.properties放在/opt/libs中并设置env var-dsun.awt.fontconfig,我可以解决它们。现在它找不到字体,即使我试着把它们放在几个地方。

SXSSFSheet sheet = sxssfWorkbook.createSheet(sheetName);

错误:

java.lang.NullPointerException
    at sun.awt.FcFontManager.getDefaultPlatformFont(FcFontManager.java:76)
    at sun.font.SunFontManager$2.run(SunFontManager.java:443)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.font.SunFontManager.<init>(SunFontManager.java:386)
    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 java.awt.Font.getFont2D(Font.java:491)
    at java.awt.Font.canDisplayUpTo(Font.java:2064)
    at java.awt.font.TextLayout.singleFont(TextLayout.java:470)
    at java.awt.font.TextLayout.<init>(TextLayout.java:531)
    at org.apache.poi.ss.util.SheetUtil.getDefaultCharWidth(SheetUtil.java:273)
    at org.apache.poi.xssf.streaming.AutoSizeColumnTracker.<init> 
    (AutoSizeColumnTracker.java:117)
    at org.apache.poi.xssf.streaming.SXSSFSheet.<init>(SXSSFSheet.java:82)
    at org.apache.poi.xssf.streaming.SXSSFWorkbook.createAndRegisterSXSSFSheet(SXSSFWorkbook.java:684)
    at org.apache.poi.xssf.streaming.SXSSFWorkbook.createSheet(SXSSFWorkbook.java:705)

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题