【问题标题】:How to apply small-caps to a string via XSL FO如何通过 XSL FO 将小型大写字母应用于字符串
【发布时间】:2021-05-09 19:43:46
【问题描述】:

我正在尝试在 DITA-OT 中自定义 PDF2 插件。我想对出现在每章开头的字符串“Chapter”和章号应用小型大写字母。

到目前为止我做了什么

在我的自定义插件中,我修改了 static-content-attr.xsl 文件中的以下 __chapter__frontmatter__name__container 属性集以包含 <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>

实际结果

small-caps 不适用于字符串。

预期结果

如何使字体变体在 XSL FO 中工作?

XML 框架:DITA
发布引擎:DITA-OT 3.x
插件:org.dita.pdf2 , org.dita.pdf2.fop

【问题讨论】:

    标签: xsl-fo dita dita-ot


    【解决方案1】:

    使用字体松鼠或类似字体,并找到一个完整的变体为大写字母的整个字体。拉丁现代罗马对此很常见,因为它也有非大写斜体和粗体。它可能是免费的,但它可能会花费您 $s 并确保它已获得服务器许可。

    例如见https://www.fontsquirrel.com/fonts/Latin-Modern-Roman

    添加此字体(或字体集),然后您可能需要自定义 DITA 以使用适当的字体输出一些 fo:inline。

    【讨论】:

      【解决方案2】:

      请参阅 FOP 合规性页面。

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

      在此页面中,font-variant 被标记为不支持。

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

      如果font-variant 是您的基本要求,请考虑使用基于商业的格式化程序,例如 Antenna House Formatter。

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

      7.9.8 font-variant Basic 是这个属性被扩展了。 ☞ 字体变体

      【讨论】:

        【解决方案3】:

        您的语法是正确的(相反,它在结果树中是正确的)。见https://www.w3.org/TR/xsl11/#font-variant

        但是,FOP 不支持font-variant。见https://xmlgraphics.apache.org/fop/compliance.html#fo-property-font-variant

        如果您使用仅限小型大写字母的字体,您可能可以获得小型大写字母。 https://xmlgraphics.apache.org/fop/2.6/fonts.html 的 FOP 字体页面指出 OpenType 包含小型大写字母,但随后指出 FOP 不支持 OpenType 功能。

        还有其他格式器支持小型大写字母并与 DITA-OT 配合使用。

        【讨论】:

          猜你喜欢
          • 2021-01-06
          • 2012-12-09
          • 1970-01-01
          • 2013-02-04
          • 2019-06-08
          • 2019-08-08
          • 1970-01-01
          • 2011-05-12
          • 1970-01-01
          相关资源
          最近更新 更多