1

I am trying to customize the PDF2 plugin in DITA-OT. I want to apply small caps to the string "Chapter" and chapter number that appear at the start of every chapter.

What I did so far

In my custom plugin, I modified the following the __chapter__frontmatter__name__container attribute-set in the static-content-attr.xsl file to include <xsl:attribute name="font-variant">small-caps</xsl:attribute> :

 <xsl:attribute-set name="__chapter__frontmatter__name__container">
    
    <xsl:attribute name="font-size">14pt</xsl:attribute>
    <xsl:attribute name="font-weight">none</xsl:attribute>
    <xsl:attribute name="border-before-style">none</xsl:attribute>
    <xsl:attribute name="border-after-style">none</xsl:attribute>
    <xsl:attribute name="border-before-width">0pt</xsl:attribute>
    <xsl:attribute name="border-after-width">0pt</xsl:attribute>
    <xsl:attribute name="padding-top">10pt</xsl:attribute>
    <xsl:attribute name="font-variant">small-caps</xsl:attribute>
</xsl:attribute-set>

Actual Result

small-caps is not applied to the string.

enter image description here

Expected Result

enter image description here

How can I make font-variant work in XSL FO?

XML Framework : DITA
Publishing Engine : DITA-OT 3.x
Plugin : org.dita.pdf2, org.dita.pdf2.fop

jelovirt
  • 5,844
  • 8
  • 38
  • 49
Antony
  • 115
  • 1
  • 11

3 Answers3

1

Your syntax is correct (rather, it will be correct in the result tree). See https://www.w3.org/TR/xsl11/#font-variant

However, FOP does not support font-variant. See https://xmlgraphics.apache.org/fop/compliance.html#fo-property-font-variant

You may be able to get small caps if you use a small caps-only font. The FOP font page at https://xmlgraphics.apache.org/fop/2.6/fonts.html notes that OpenType includes small caps but then notes that FOP doesn't support OpenType features.

There are other formatters that do support small caps and that work with the DITA-OT.

Tony Graham
  • 7,306
  • 13
  • 20
1

See FOP compliance page.

https://xmlgraphics.apache.org/fop/compliance.html

In this page, font-variant is marked as not supported.

§7.9.8 font-variant Basic no no no no no no

If font-variant is your basic requirement, consider to use commercial based formatter such like Antenna House Formatter.

https://www.antenna.co.jp/AHF/help/v70e/ahf-fo11.html

7.9.8 font-variant Basic yes This property is extended. ☞ font-variant

Toshihiko Makita
  • 1,294
  • 1
  • 8
  • 15
0

Use font squirrel or similar and find a whole font that has a complete variant that is CAPS. Latin Modern Roman is common for this as it also has non-CAP Italic and Bold. It may be free but it ay cost you $s and be sure it is licensed for server.

See https://www.fontsquirrel.com/fonts/Latin-Modern-Roman for example

Add this font (or set of fonts) and hen you would likely need to customize DITA to output some fo:inline with the appropriate font.

Kevin Brown
  • 8,805
  • 2
  • 20
  • 38