在 openjdk 中使用 stix 字体的异常? [英] Exception using stix-fonts with openjdk?

查看:34
本文介绍了在 openjdk 中使用 stix 字体的异常?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我尝试创建 SXSSFWorkbook 时出现问题.

Problem happens while i try to create SXSSFWorkbook .

异常堆栈跟踪:

java.lang.ArrayIndexOutOfBoundsException: 0
    at sun.font.CompositeFont.getSlotFont(CompositeFont.java:351)
    at sun.font.CompositeGlyphMapper.initMapper(CompositeGlyphMapper.java:81)
    at sun.font.CompositeGlyphMapper.<init>(CompositeGlyphMapper.java:62)
    at sun.font.CompositeFont.getMapper(CompositeFont.java:409)
    at sun.font.CompositeFont.canDisplay(CompositeFont.java:435)
    at java.awt.Font.canDisplayUpTo(Font.java:2063)
    at java.awt.font.TextLayout.singleFont(TextLayout.java:470)
    at java.awt.font.TextLayout.<init>(TextLayout.java:531)
    at FontTest.main(FontTest.java:15)

gradle 文件:

compile 'org.apache.poi:poi:3.14'
compile 'org.apache.poi:poi-ooxml:3.14'

环境:

  • openjdk 版本1.8.0_141"
  • 红帽 7.4
  • wildfly 10.0.0

推荐答案

该问题仅发生在 Red hat 7.4 版.据报道那里.红帽人员正在此处修复它.我找到的解决方案只是提供字体以强制将 Utopia 作为默认字体,由 java 使用.

The issue happened only on Red hat version 7.4. it is reported there. and the Red hat guys are working to fix it here. the solution I found is just to provide the fonts in order to force back Utopia as the default font, used by java.

使用以下内容创建以下文件 /etc/fonts/local.conf:

Create the following file /etc/fonts/local.conf with the following content:

<?xml version='1.0'?>
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
<fontconfig>
  <alias>
    <family>serif</family>
    <prefer><family>Utopia</family></prefer>
  </alias>
  <alias>
    <family>sans-serif</family>
    <prefer><family>Utopia</family></prefer>
  </alias>
  <alias>
    <family>monospace</family>
    <prefer><family>Utopia</family></prefer>
  </alias>
  <alias>
    <family>dialog</family>
    <prefer><family>Utopia</family></prefer>
  </alias>
  <alias>
    <family>dialoginput</family>
    <prefer><family>Utopia</family></prefer>
  </alias>
</fontconfig>

确保文件可由正确的用户读取.

Make sure the file is readable by the correct user.

这篇关于在 openjdk 中使用 stix 字体的异常?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆