Specifying a custom font

325 views Asked by At

Is there a way to specify a custom font (i.e. one that's not installed in the Windows/Fonts folder) in my XSL-FO stylesheet?

In CSS, you can do this:

@font-face {
    font-family: OpenSans;
    src: url(OpenSans-Regular.ttf);
}

Is something similar possible in XSL-FO?

I've checked the Antennahouse Formatter docs. AHF allows you to specify custom font folders in the Font Configuration File, but that is a systemwide file. I want to set a font for a single stylesheet without affecting other stylesheets.

1

There are 1 answers

0
Tony Graham On BEST ANSWER

Add axf:font-face (see https://www.antennahouse.com/product/ahf66/ahf-ext.html#axf.font-face) inside fo:declarations.

The example from the documentation is:

<fo:declarations>
  <axf:font-face src="url('http://www.hixie.ch/resources/fonts/AHEM____.TTF')"
                 font-family="AHEM"/>
</fo:declarations>