首页 > 解决方案 > 指定自定义字体

问题描述

有没有办法在我的 XSL-FO 样式表中指定自定义字体(即未安装在 Windows/Fonts 文件夹中的字体)?

在 CSS 中,您可以这样做:

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

XSL-FO 中是否有类似的可能?

我检查了 Antennahouse Formatter 文档。AHF 允许您在字体配置文件中指定自定义字体文件夹,但这是一个系统范围的文件。我想为单个样式表设置字体而不影响其他样式表。

标签: xsl-foantenna-house

解决方案


在里面添加axf:font-face(见https://www.antennahouse.com/product/ahf66/ahf-ext.html#axf.font-facefo:declarations

文档中的示例是:

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

推荐阅读