Discussion:
[Exist-open] Apache FOP fonts configuration
Honza Hejzl
2017-03-01 11:56:02 UTC
Permalink
Hi all,

I have done several tests but I am still struggling with basic
configuration of FOP.

As Adam mentioned here
<http://apache-fop.1065347.n5.nabble.com/font-base-is-ignored-in-2-1-td43690.html>
it seems FOP somehow ignores <font-base/> and even <base/> if the config is
provided to FOP dynamically from XQuery.

If I use FOP 2.1 on command line, everything works, no matter if I use full
path to a filesystem or some url (e.g. to a rest point of an eXist app).
Hence I guess this problem lies somewhere between eXist and FOP.

It is possible to use workaround and load fronts from the filesystem
directly with @embed-url:
<font kerning="yes"
embed-url="file://full-path-to-fonts-in-expathrepo/libertine/font.ttf"
embedding-mode="subset">

If I try to use <font-base/> with exactly the same path, it does not work:
<font-base>/home/user/eXist-db/webapp/.../</font-base>
and
<font kerning="yes" embed-url="font.ttf" embedding-mode="subset">
it throws URI scheme is not "file" error.

If I use:
<font-base>/home/user/eXist-db/webapp/.../</font-base>
and
<font kerning="yes" embed-url="file:font.ttf" embedding-mode="subset">
it throws URI is not hierarchical error (logically).

This means it is not possible to use the elegant <font-base/> for resolving
font uris at all.

The next thing is <base/>, which is successfully ignored by FOP. The
workaround is for me pushing the resource URL to XSL and there to resolve
paths directly (not elegant, working).

And the last thing is it is not possible to use font loading with
@embed-url:
<font kerning="yes"
embed-url="file://full-path-to-fonts-in-expathrepo/libertine/font.ttf"
embedding-mode="subset">

When I try to load the font with a dynamic config from a simple XQuery
placed outside of an app collection, FOP ignores the setting and uses
generic fonts. This is most confusing.

I thought the problem was eXist loaded TTF fonts as of application/xml
mime-type but even after solving this it does not work.

I solved that with workarounds mentioned above but it would be great to
track the issue and solve it in general.

Greetings from Prague, Honza
Welblaud
2017-03-01 13:06:34 UTC
Permalink
I am sorry I didn’t specified the eXist version, it is 3.0 stable.

Best, Honza



--
View this message in context: http://exist.2174344.n4.nabble.com/Apache-FOP-fonts-configuration-tp4671559p4671564.html
Sent from the exist-open mailing list archive at Nabble.com.
Welblaud
2017-03-01 13:23:50 UTC
Permalink
And thanks to Joe I am adding OS info.

Tests with eXist 3.0 stable are done on Ubuntu 12.04 LTS, tests with FOP 2.1
are done on Ubuntu 16.04 LTS. I am doing that because in 12.04 version it is
not easy to upgrade to FOP 2.1. Later I want to migrate eXist there too.

Best, Honza



--
View this message in context: http://exist.2174344.n4.nabble.com/Apache-FOP-fonts-configuration-tp4671559p4671565.html
Sent from the exist-open mailing list archive at Nabble.com.

Loading...