我有配置文件可以加载Apache FOP的自定义字体。我正在努力在服务器上配置embed-url,以便根据服务器域更改字体url。
我尝试将embed-url属性值设置为:
无效的嵌入网址:
工作内嵌网址:
我似乎无法在这里找到正确的语法。我在AEM 6.0中使用FOP。
<?xml version="1.0"?>
<fop version="1.0">
<renderers>
<renderer mime="application/pdf">
<fonts>
<font kerning="yes"
embed-url="context:/etc/designs/projectName/clientlibs/pdffonts/Batang.ttf" -- this doesn't
embedding-mode="subset">
<font-triplet name="SimSun" style="normal" weight="normal" />
</font>
<font kerning="yes"
embed-url="file:/etc/designs/projectName/clientlibs/pdffonts/Batang.ttf" -- this doesn't
embedding-mode="subset">
<font-triplet name="Batang" style="normal" weight="normal" />
</font>
<font kerning="yes"
embed-url="http://localhost:4503/etc/designs/projectName/clientlibs/pdffonts/Batang.ttf" -- this works
embedding-mode="subset">
<font-triplet name="Batang" style="normal" weight="normal" />
</font>
</fonts>
</renderer>
</renderers>
</fop>
Run Code Online (Sandbox Code Playgroud)
相对路径的“起点”:
font-base元素(作为文档根元素的直接子元素),则其值用于解析相对字体路径base使用元素的值代替<base>.</base>,这意味着相对路径必须解释为相对于配置文件的位置请注意,和的值font-base也base可以是相对的,在这种情况下,它们指的是配置文件路径。
<?xml version="1.0"?>
<fop version="1.0">
<base>.</base>
<font-base>/Users/lfurini/Library/Fonts</font-base>
<!-- other possible examples:
<font-base>.</font-base>
<font-base>../fonts</font-base>
-->
<!-- ... -->
</fop>
Run Code Online (Sandbox Code Playgroud)
相对路径语法:
context:或file:embed-url有开始/这是一个绝对路径,否则它是一个相对引用之前定义的“起点”../如果需要,相对路径可以包含要在文件夹层次结构中备份的内容
<!-- directly in the base folder -->
<font kerning="yes" embed-url="font1.ttf">
<font-triplet name="font1" style="normal" weight="normal"/>
</font>
<!-- in a "sister" folder -->
<font kerning="yes" embed-url="../otherFonts/font2.ttf">
<font-triplet name="font2" style="normal" weight="normal"/>
</font>
<!-- in a sub-folder -->
<font kerning="yes" embed-url="specialFonts/font3.ttf">
<font-triplet name="font3" style="normal" weight="normal"/>
</font>
<!-- absolute path -->
<font kerning="yes" embed-url="/Users/lfurini/Library/Fonts/font4.ttf" embedding-mode="subset">
<font-triplet name="font4" style="normal" weight="normal"/>
</font>
Run Code Online (Sandbox Code Playgroud)(经过FOP 1.1、2.0和2.1测试)
(披露:我是一名FOP开发人员,尽管现在不是很活跃)
| 归档时间: |
|
| 查看次数: |
1647 次 |
| 最近记录: |