Java – Apache FOP and Arial fonts

My XSL style uses Arial font

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

Configuration file fonts xml:

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

I've also tried this:

<auto-detect/>

and

<directory>C:\windows\fonts</directory>

I always get:

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

What should I fix to use Arial font?

Solution

This is useful for me. I need to specify the Arial font in the configuration file:

<?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>
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>