Apache FOP和Arial字体

时间:2013-05-14 16:17:28

标签: java apache xslt apache-fop

我的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:\windows\fonts</directory>

我总是得到:

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

为了使用Arial字体,我应该修复什么?

1 个答案:

答案 0 :(得分:7)

这对我有用,需要在配置文件中明确指定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>