[WG: I18N & L10N] i18n of PDF file

=?GB2312?B?uN+sQg==?= gaojun at fudan.edu.cn
Tue Mar 6 22:35:43 PST 2012


Hi,

Some tools provide function of exporting PDF. Most of these are not i18n
friendly.
Some of these tools use Apache FOP to render PDF via XSLT and XSL-FO.
Yet, a pdf
with special characters (Chinese, in my case) would not shown properly.
By default,
PDF files support 14 fonts which doesn't contain Asian chars. So each
Asian chars is
replaced by '#'.

So, I think it's very important to allow administrator to set a "default
font" to show this
chars, may be an entry in sakai.properties would meet the need.

I seach the code and find 4 tools use Apache FOP: calendar, wiki,
site-manage and
sitestats. And fix site-manage and calendar tool in local repository.
Follows are the main
change:

1. Use FOP 1.0 instead of previous FOP versions (like 0.20.5). This will
bring the new feture
of detect System fonts automatically. With out this feature, admin must
compile a xml
file to represent font (like calendar tool used to be).

2. Use a dummy font "DEFAULT_FONT" as "font-family" at <fo:root> in XSL
file. This
value would be replaced by a custom value "fop.pdf.default.font" in
sakai.properties.
If this value is not set, then the default PDF font "Helvetica" will be
used. So, this change
would not influence the latin-1 users.

3. Modify the XSL file to meet FOP 1.0 which check XSL file more
strictly than previous
versions

If you have some good idea to improve this or you know some other
solution, please tell
me. After fix the four tools metioned before, I'll fire a JIRA issue to
submit my code.

[1] http://xmlgraphics.apache.org/fop/1.0/fonts.html#Base-14+Fonts

-- 
Gao Jun
Fudan University




More information about the i18n mailing list