How to set global font-family in Apache FOP? How to set global font-family in Apache FOP? apache apache

How to set global font-family in Apache FOP?


If you want to set default font for whole document you can set it in fo:root. It should get inherited by every child-node without specified font-family.

<fo:root font-family="Tahoma">    <!-- rest of document --></fo:root>


you can use the node fo:wrapper to inherit properties to its content-childs

<fo:page-sequence master-reference="A4-portrait">    <fo:flow flow-name="xsl-region-body">        <fo:wrapper font-size="10pt" font-family="Tahoma">            <fo:block>                Text <xsl:value-of select="name"/>            </fo:block>            <fo:block>                Another text            </fo:block>        </fo:wrapper>    </fo:flow>   </fo:page-sequence>


  <fonts>    <referenced-fonts>      <match font-family="Tahoma"/>    </referenced-fonts>  </fonts>

OR

<fo:page-sequence master-reference="A4-portrait">  <fo:flow flow-name="xsl-region-body">    <fo:block font-size="10pt" font-family="Tahoma">      Text <xsl:value-of select="name"/>    </fo:block>  </fo:flow>   </fo:page-sequence>