Reputation: 1532
I got stuck with a problem that I can't resolve myself. I tried to simplify source code as much as I could and here is what I came up with - https://www.dropbox.com/s/ey3f65c4iby7ccn/fop_example.zip.
Here is the main piece of code (code of the template)
<?xml version="1.0" encoding="UTF-8"?>
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" font-family="Arial">
<fo:layout-master-set>
<fo:simple-page-master master-name="simpleA4" page-height="29.7cm" page-width="21cm">
<fo:region-body reference-orientation="0"/>
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="simpleA4">
<fo:flow flow-name="xsl-region-body">
<fo:block-container>
<fo:block>
ИмяпассажираКУЛЬДЮШЕВАЛИЯАЛЕКСАНДРОВНАДокументудостоверяющийличностьНомербилетаДоСОЧИСОЧРейсИЖВылетАВГКлассЭРЕГ№ВАЖНАЯИНФОРМАЦИЯ
</fo:block>
</fo:block-container>
</fo:flow>
</fo:page-sequence>
</fo:root>
I can't simplify this long text because if I remove any character everything will work fine. So the problem is with the last letters. Instead of "ИНФОРМАЦИЯ" I get "ИНФОРМ~ИЯ" and if I remove or add any other cyrillic letter everything will be ok, so I guess the problem isn't with fonts.
Why's that? Please help me, I have no idea what's wrong or how to fix it.
P.S. Here is a link to the resulting pdf, maybe you could say what's wrong by simply looking at this file.
P.P.S Tried to replace this text with ИмяпассажираКУЛЬДЮШЕВАЛИЯАЛЕКСАНДРОВНАДокументудостоверяющийличностьНомербилетаДоСОЧИСОЧРейсИЖВылетАВГКлассЭРЕГ№ВАЖНАЯИНФОРМАЦИЯ
, still get the same result.
Text with only problem characters presented in unicode:
ИмяпассажираКУЛЬДЮШЕВАЛИЯАЛЕКСАНДРОВНАДокументудостоверяющийличностьНомербилетаДоСОЧИСОЧРейсИЖВылетАВГКлассЭРЕГ№ВАЖНАЯИНФОРМАЦИЯ
I managed to do the example even shorter:
ИмяпсжираКУЛЬДЮШЕВАЯкудсвющийличньорбилетаСЧВыЭГ№ЖНФОРМАЦИЯ
Upvotes: 2
Views: 897
Reputation: 1532
It turns out the problem was because of the incorrect encoding mode.
<font kerning="yes" embed-url="/arial.ttf" encoding-mode="single-byte">
<font-triplet name="Arial" style="normal" weight="normal"/>
</font>
I should have used cid instead of single-byte because I embed .ttf (TrueType) and according to the documentation default (and I think that means preferable) option is
"cid" for Truetype, "single-byte" for Type 1
Hovewer, I suppose it'a bug of the library, because if I want to embed the font completely I have to use the single-byte mode.
When embedding TrueType (ttf) or TrueType Collections (ttc), a subset of the original font, containing only the glyphs used, is embedded in the output document. That's the default, but if you specify encoding-mode="single-byte" (see above), the complete font is embedded.
Upvotes: 2