Multilingual Topic in PDF2

Here should go questions about transforming XML with XSLT and FOP.
dreifsnider
Posts: 102
Joined: Thu Aug 30, 2018 10:06 pm

Multilingual Topic in PDF2

Post by dreifsnider »

I have a DITA topic that contains both English and Japanese characters.

I'm using a custom pdf2 plugin in the dita-ot 3.1, which I believe is using apache fop 2.3.

My font-mappings.xml for the applicable font-family is:

Code: Select all

<logical-font name="SST-Bold">
<physical-font char-set="default">
<font-face>SST-Bold</font-face>
</physical-font>
<physical-font char-set="Japanese">
<font-face>SSTJpPro-Bold</font-face>
</physical-font>
</logical-font>
I've set the xml:lang="ja-JP" attribute on the applicable elements; however, the Japanese characters are rendering as #, which I believe Apache FOP is doing for missing glyphs.

I'm thinking that FOP is setting the entire topic to EN, and ignoring the xml:lang attribute on the elements. I know that the font being used for the default char-set does not contain Japanese glyphs, but I would expect the xml:lang attribute to be preserved and the char-set for the applicable elements to be set to Japanese.

Is it possible to use two different fonts (one font for the English glyphs, another for the Japanese glyphs) for a topic in a PDF output?

Thank you!

Daniel
Radu
Posts: 9018
Joined: Fri Jul 09, 2004 5:18 pm

Re: Multilingual Topic in PDF2

Post by Radu »

Hi Daniel,

As far as I know the classic PDF output does not properly support outputting two languages in the same PDF. This is not a limitation in the Apache FOP PDF engine but in the DITA OT PDF plugin.
But you can try to register on the DITA Users List and ask around, maybe they know more about that than I do.

As workarounds:

1) In the last couple of years we added in Oxygen a new way to obtain PDF from DITA using CSS for styling:

https://www.oxygenxml.com/doc/versions/ ... 5-x-2.html

and using this CSS-based approach you would just need to write selectors similar to this:

Code: Select all


*:lang(ja) {
font-family: "SSTJpPro" !important;
}
2) Antenna House has a custom DITA OT plugin which supports from what I know multiple languages in the same PDF:

https://github.com/AntennaHouse/pdf5

but it only works with their commercial Antenna House engine.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
dreifsnider
Posts: 102
Joined: Thu Aug 30, 2018 10:06 pm

Re: Multilingual Topic in PDF2

Post by dreifsnider »

Thanks for your help once again Radu!

I'll ask on the DITA Users Group and see if I get a response.

I did see this existing issue in the dita-ot github source: https://github.com/dita-ot/dita-ot/issues/1250 but I wasn't sure if it's still relevant.

My team is heavily investigating moving over to using Oxygen's PDF Chemistry, but for the moment we're stuck with xsl:fo and FOP.

Thanks again!

Daniel
dreifsnider
Posts: 102
Joined: Thu Aug 30, 2018 10:06 pm

Re: Multilingual Topic in PDF2

Post by dreifsnider »

For what it's worth, I took a look on the Yahoo DITA Users Group, and came across this post by Aliza:

https://groups.yahoo.com/neo/groups/dit ... ages/43256

I added the Japanese char-sets to the en.xml i18n and the Japanese glyphs now correctly display alongside the English.

Cheers!

Daniel
Radu
Posts: 9018
Joined: Fri Jul 09, 2004 5:18 pm

Re: Multilingual Topic in PDF2

Post by Radu »

Hi Daniel,

Thanks for sharing the solution on this thread.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Post Reply