Search code examples
javaapachepdffontsapache-fop

How to set global font-family in Apache FOP?


This is what I've used before:

 <fo:block font-family="Tahoma">Text</fo:block>

How can I specify that "Tahoma" is the font-family for the entire document?

I am looking for an equivalent of CSS's

body {
  font-family: "Tahoma";
}

Solution

  • 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>