Re: question about East Asian fonts handling in XFC triggered from XXE (DITA document)

Hussein Shafie <[email protected]> Fri, 21 Oct 2016 14:21:42 +0200
Newsgroups gmane.text.xml.xfc.general,gmane.editors.xxe.general
Message-ID <[email protected]>
--> For your font mapping:

---
MS Mincho=Times New Roman,MS PGothic=Arial,MS Gothic=Courier New
---

to work, the XSL-FO file generated by our DITA Converter must reference 
any of the following fonts:

MS Mincho OR MS PGothic OR MS Gothic

Out of the box, this is not the case. By default, the XSL-FO file 
generated by our DITA Converter references only generic font families 
(serif, sans-serif, monospace). Hence your font mapping is never used.



--> It's feasible, but not easy nor convenient, to instruct our DITA 
Converter to generate references to Japanese fonts (MS Mincho) rather 
than references to generic (serif).

Fortunately, (A) by default, our DITA Converter generates references to 
the generic font families  and (B) our XSL-FO processor makes it easy 
mapping generic font families to any font family you want.

For example:

---
<parameter name="genericFontFamilies">serif=MS Mincho,sans-serif=MS 
PGothic,monospace=MS Gothic</parameter>
---


--> Therefore the solution to your problem is two-fold:

For DITA documents which mainly contain Japanese text,

1) Map generic font families to Japanese font families:

---
<parameter name="genericFontFamilies">serif=MS Mincho,sans-serif=MS 
PGothic,monospace=MS Gothic</parameter>
---

2) Specify which western fonts you want to use for non-Japanese characters:

---
<parameter name="eastAsiaFontFamilies">MS Mincho=Times New Roman,MS 
PGothic=Arial,MS Gothic=Courier New</parameter>
---

This seems to work fine, at least on my en-US Windows/MS-Word 2007. See 
attached Test.dita and Test.docx. Also see attached screenshots.

References:

* Parameter "genericFontFamilies" in 
http://www.xmlmind.com/foconverter/_distrib/doc/user/command_line_java.html

* "Special support for East Asian fonts" in 
http://www.xmlmind.com/foconverter/_distrib/doc/user/implementation.html#east_asian_fonts



-----
PS 1: Rather than directly modifying "C:\Program 
Files\XMLmind_XML_Editor\addon\config\dita\xslMenu.incl", it's simpler 
to add this parameter group:

---
<parameterGroup name="dita.toRTF.XFCParameters">
    <parameter name="genericFontFamilies">serif=MS Mincho,sans-serif=MS 
PGothic,monospace=MS Gothic</parameter>
    <parameter name="eastAsiaFontFamilies">MS Mincho=Times New Roman,MS 
PGothic=Arial,MS Gothic=Courier New</parameter>
</parameterGroup>
---

to your customize.xxe.

See 
http://www.xmlmind.com/xmleditor/_distrib/doc/configure/bindings_generic.html





Yuriko N. wrote:
>
> I have a question about how to use XMLmind XSL-FO Converter
> bundled with the XXE that we have purchased, for mixed fonts file.
>
>
> I read in manual of XFC " 4.8. Special support for East Asian fonts" as follows.
>
> ##########################
> 2.	When a text run contains a mix of CJK text and Western text, the "Times New Roman" and "Calibri" fonts will be used to render the Western text segments. In the above example, "romaji neko" is rendered using the "Times New Roman" font, even if the fo:inline containing this segment requests "MS UI Gothic".
> ###########################
>
> In order to use XFC with Section 4.8 feature from within XXE used for DITA,
> I added
> <parameter name="eastAsiaFontFamilies">MS Mincho=Times New Roman,MS PGothic=Arial,MS Gothic=Courier New</parameter>
> into
> "C:\Program Files\XMLmind_XML_Editor\addon\config\dita\ xslMenu.incl"
>
> I added as follows.
>
>       <processFO processor="XFC" file="__doc.fo" to="__doc.%0">
>         <parameter name="outputFormat">%0</parameter>
>         <parameter name="outputEncoding">%1</parameter>
>         <parameter name="imageResolution">120</parameter>
>         <parameter name="prescaleImages">false</parameter>
> 	<parameter name="eastAsiaFontFamilies">MS Mincho=Times New Roman,MS PGothic=Arial,MS Gothic=Courier New</parameter>
> 	<parameterGroup name="dita.toRTF.XFCParameters" />
>       </processFO>
>
>
> I add the above and convert into WORD from DITA,
>
> I tested DITA input as "<p>ねこ ‎romaji neko</p>" (same as your sample)
>
> My assumption is that it will be converted into WORD
>  "ねこ" part as " MS Mincho" and "‎romaji neko" part as " Times New Roman".
>
> But when I processed it, the total string "ねこ ‎romaji neko" becomes " MS Mincho".
>
> I checked fonts in the created WORD file by opening that file with MS WORD.
> Screen shot is attached.
> You can see that when I select "ねこ" part and it shows font MS明朝(MS MONCHO).
> I select " neko " part and it also shows font MS明朝(MS MONCHO).
>
> I'd like to have the "romaji neko" (Western text part) rendered with "Times New Roman" font as
> explained in manual because it will look better.
>
> Am I setting something wrong ?


--
XMLmind FO Converter Support List
[email protected]
http://www.xmlmind.com/mailman/listinfo/xfc-support
Test.dita (text/xml, 1.4 KB)
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN"
"topic.dtd">
<topic id="Test" xml:lang="jp">
  <title>PDFを最大限に活用できる『瞬簡PDFシリーズ』の 5つのソフトを同梱したお得なパッケージ!</title>

  <body>
    <p>『瞬簡PDF 統合版
    9』はPDFを最大限に活用できる『瞬簡PDFシリーズ』の5製品を同梱した大変便利でお得なパッケージ製品です。PDFの作成、ページ入れ換えなどの編集、Office文書への変換、文字の書き込み、捺印、ページ番号の追加、しおりの編集など、さまざまな機能を持つソフトが詰まっています。</p>

    <section><title>書けまっせPDF 7 PDFへの書き込みソフトが『瞬簡PDF 書けまっせ
    7』にバージョンアップ!</title><p>今回のバージョンアップでは、PDFに文字や図形を自由に書き込めるソフトウェアが、同時リリースの『瞬簡PDF
    書けまっせ
    7』になりました。入力欄の自動認識の速度や精度が向上し、またマルチタッチとペン入力できるパソコンでの操作が快適にできるようになりました。</p><p> <xref
    href="http://www.antenna.co.jp/kpd/">『瞬簡PDF 書けまっせ 7』について詳しくはこちら
    ⇒</xref></p></section>
  </body>
</topic>
Test.docx (application/vnd.openxmlformats-officedocument.wordprocessingml.document, 5.3 KB) - not displayed
MSPGothic.png (image/png, 66 KB) - not displayed
Arial.png (image/png, 66.7 KB) - not displayed