Re: Convert a DocBook xml file to PDF format, all C hinese character became ‘#######’
Hussein Shafie <[email protected]> Tue, 18 Jul 2017 15:43:54 +0200
| Newsgroups | gmane.text.xml.xfc.general,gmane.editors.xxe.general |
|---|---|
| Message-ID | <[email protected]> |
On 07/18/2017 11:29 AM, 梅隆魁 wrote: > > > When I use XMLMind XML Editor or XMLMind DocBook Editor > Personal Edition 7.4.1 to convert a DocBook xml file to PDF format, all > Chinese characters become ‘#######’, but all English characters are > fine, like: > > The xml file itself is encoded in UTF8(<?xml version="1.0" > encoding="UTF-8"?>). I have tried to set the body.font.family parameter > but it does not work: > > [SCREENSHOT SHOWING PARAMETER body.font.family SET TO "msyph"] > > I have also tried to set the embedded font but it does not work either: > > [SCREENSHOT SHOWING MSYH.TTC ADDED TO THE FOP PREFERENCES] The problem comes from the fact that there is no font called "msyph". "msyph" is just the name of the TTC file. The font is called "Microsoft YaHei". If you set body.font.family to Microsoft YaHei, it should work. I did that and it worked fine. See attached samples. --> BETTER SOLUTION <-- This being said, you'd better REMOVE your parameter body.font.family and do what is explained this FAQ: --- When I convert documents written in Russian (or Polish or Czech or any non-western language) to PDF, almost all characters are replaced by the "#" character. Is there a workaround for this problem? --- http://www.xmlmind.com/xmleditor/faq.html#custom_pdf_fonts The DocBook XSL stylesheets use *several* font families: sans-serif, serif and monospace, so you'd better MAP each of these 3 generic font families to a Chinese equivalent as explained in the FAQ (e.g. map "Microsoft YaHei" to sans-serif normal, bold, italic, bolditalic). --- PS: Everything explained here also applies to XMLmind XSL Utility. -- XMLmind FO Converter Support List [email protected] http://www.xmlmind.com/mailman/listinfo/xfc-support
Chinese.xml
(text/xml, 3.2 KB)
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
<book lang="zh">
<bookinfo>
<title>善讼的人的故事</title>
<subtitle>The Advocate</subtitle>
<author>
<surname>Lai Ho</surname>
</author>
</bookinfo>
<chapter>
<title>赖和</title>
<para>「先生!可怜咧,求你向志舍讲一声,实在是真穷苦,这是先生所素知的;一</para>
<para>具薄板仔,亲戚间已经是艰苦负担,散人〔散赤人,穷苦人〕本无富户的亲戚,志</para>
<para>舍这样家私,少收五钱银是不关轻重,求你做好心,替我讲一声。」</para>
<para> 「你我只隔一竹围,你的事情我那有不知,不过头家有些皮气,我是他所用的</para>
<para>人,还是你去托一个相当的人来讲,五钱银他几嘴阿片就烧去了,应当是会允许。」</para>
<para> 「林先生,除起你,还有什么人可拜托?草地人到这所在,不是有你在此,跨</para>
<para>过户碇〔门槛〕都不敢,和他相当的人,要去拜托谁?总是求你做好心咧!」</para>
<para> 「头家现在又正在『午眠』,我又不能主意,你下晡再来,我替你讲一声看?」</para>
<para> 「人是大昨日就死去了,不能再放置下去,总求先生给管山的讲一声,让我们</para>
<para>先去安葬,志舍醒来时若说不肯,总算让我欠些时,我当『拍拚』〔拚命〕来清还;</para>
<para>虽赚不到,儿子也须卖来还他,定不连累到先生。」</para>
<para> 「啊!」林先生叹一下气,说:「无法度!好,我写张字你提去给管山的看,</para>
<para>等候头家醒来,我替你讲看,不过这是不一定,钱---你也着去设法。」</para>
<para> 林先生是被雇在志舍家里,替他掌管账目,和办理一切事务;听说是番社庄人,</para>
<para>是不是生番的后裔,现在没人晓得,但是他的性质却很率直果敢;当他遣走了来央</para>
<para>求他的邻人之后,心里甚是不安,总在门前厝内,行来走去。</para>
<para> 他想起头家对他所讲的话来:「在有钱人的面前,因为想得到些怜悯赏赐,人</para>
<para>是什么都敢装做的。」他觉得这次的主意,在这款主人之下有一点不妥,同时又对</para>
<para>主人唯利是视的行为生起反感。---「现今是钱的天下,有钱也就有名誉幸福,但是</para>
<para>也须有无钱的人,才见得钱的威风;无钱的人,是要使有钱的享福快乐,才有他们</para>
<para>生存的使命,神是为着有钱的人,才创造他们的。」想到主人这样自鸣得意的态度,</para>
<para>又钩起林先生不少的憎恶。</para>
<para> 觉他得在这样主人之下服务,是真无趣,因为他自己也是无钱的人。但是再一</para>
<para>反想,为着生又不能就舍弃头路,这样想来想去,林先生也自己惘惘然不知要怎样</para>
<para>了。</para>
</chapter>
</book>
Chinese.pdf
(application/pdf, 123.3 KB) - not displayed
using_msyh_as_an_alias_for_sans-serif.png
(image/png, 95.9 KB) - not displayed
setting_body_font_family_to_msyh.png
(image/png, 59.7 KB) - not displayed