加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > Java > 正文

java – Apache FOP和Arial字体

发布时间:2020-12-15 04:10:14 所属栏目:Java 来源:网络整理
导读:我的XSL样式使用Arial字体 fo:block font-family="Arial" font-size="8pt" font-weight="normal" 配置文件fonts.xml: ?xml version="1.0"?fop renderers renderer mime="application/pdf" fonts basefile:///C:/windows/fonts/base /fonts /renderer /rende
我的XSL样式使用Arial字体

<fo:block font-family="Arial" font-size="8pt" font-weight="normal">

配置文件fonts.xml:

<?xml version="1.0"?>
<fop>
  <renderers>
    <renderer mime="application/pdf">
      <fonts>   
        <base>file:///C:/windows/fonts</base>
      </fonts>
    </renderer>
  </renderers>
</fop>

也试过用这个:

<auto-detect/>

<directory>C:windowsfonts</directory>

我总是得到:

WARNING: Font "Arial,normal,400" not found. Substituting with "any,400".

我应该修复什么才能使用Arial字体?

解决方法

这对我有用,需要在配置文件中明确指定Arial字体:

<?xml version="1.0"?>
    <fop>
      <renderers>
        <renderer mime="application/pdf">       
          <fonts>                           
                <font kerning="yes"  embed-url="file:///C:/windows/fonts/arial.ttf">
                      <font-triplet name="Arial" style="normal" weight="normal"/>
                    </font>                     
            </fonts>
        </renderer>
      </renderers>     
</fop>

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读