如何解决如何通过 XSL FO 将小型大写字母应用于字符串
我正在尝试在 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
解决方法
您的语法是正确的(而是在结果树中是正确的)。见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 配合使用。
,请参阅 FOP 合规性页面。
https://xmlgraphics.apache.org/fop/compliance.html
在此页面中,font-variant
被标记为不支持。
§7.9.8 font-variant Basic 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 yes 这个属性被扩展了。 ☞ 字体变体
,使用 font squirrel 或类似字体并找到具有完整变体的完整字体,即大写字母。拉丁现代罗马字很常见,因为它也有非大写斜体和粗体。它可能是免费的,但需要花费您几美元,并确保它已获得服务器许可。
例如参见https://www.fontsquirrel.com/fonts/Latin-Modern-Roman
添加此字体(或一组字体),然后您可能需要自定义 DITA 以使用适当的字体输出一些 fo:inline。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。