Search code examples
xsl-foantenna-house

Multiple fonts of the same family in axf:font-face tag


I am confused about the <axf:font-face> tag, and I think I am not using it correctly.

I specified the font Helvetica with font-weight=300 and font-weight=100:

<fo:declarations>
    <axf:font-face src="url(Helvetica-01.ttf)" font-family="Helvetica" font-style="normal" font-weight="300"/>
    <axf:font-face src="url(Helvetica-Light-05.ttf)" font-family="Helvetica" font-style="normal" font-weight="100"/>
</fo:declarations>

Later in the stylesheet, I want to print some text with font-weight="100":

<fo:block font-family="Helvetica" font-weight="100">SOME TEXT</fo:block>

But in the FO output I see font-weight="300", instead.

Is there a mistake in how I specify the fonts?


Solution

  • Which AH Formatter version are you using? Are you getting any error messages about not finding font files?

    I get the expected font weights when using AH Formatter V6.6 (with different font files because I don't have your Helvetica):

    <fo:declarations>
      <axf:font-face src="url(SourceSansPro-Black.otf)" font-family="Helvetica" font-style="normal" font-weight="300"/>
      <axf:font-face src="url(SourceSansPro-Regular.otf)" font-family="Helvetica" font-style="normal" font-weight="100"/>
    </fo:declarations>
    <fo:page-sequence master-reference="spm">
        <fo:flow flow-name="xsl-region-body">
            <fo:block font-family="Helvetica">Hello, world.</fo:block>
            <fo:block font-family="Helvetica" font-weight="100">Hello, world.</fo:block>
        </fo:flow>
    </fo:page-sequence>