答复: Convert a DocBook xml file t o PDF format, all Chinese character became ‘ #######’

梅隆魁 <[email protected]> Mon, 31 Jul 2017 14:10:05 +0800
Newsgroups gmane.text.xml.xfc.general
Message-ID <[email protected]>
Thank you very much!

I have solved the problem with all your help. Through I am a programmer, it still cost me hours to set the 'almost right' font(s) for a book whose theme is about programming written in Chinese, because for a complete DocBook2PDF actually involves several different fonts. What will happen to a common user who has no background about computer technology?

 

My final preference is(the reason why I said 'almost right' is that some of the fonts does not support full Unicode chars):



 

With:

1、Chinese“黑体”for figure title and some bold font


2、Chinese“楷体” for codes


3、Chinese“SimSun”for the main body



4、Microsoft YaHei for the bold chapter title



 

 

Is there is a better way to provide the user some profiles for some special language like Chinese and Russ?

 

-----邮件原件-----
发件人: Hussein Shafie [mailto:[email protected]] 
发送时间: 2017年7月18日 21:44
收件人: 梅隆魁
抄送: '[email protected]'; [email protected]
主题: Re: Convert a DocBook xml file to PDF format, all Chinese character became ‘#######’

 

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> 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
image001.png (image/png, 33.8 KB) - not displayed
image002.png (image/png, 39.4 KB) - not displayed
image004.png (image/png, 37.7 KB) - not displayed
image010.jpg (image/jpeg, 28 KB) - not displayed
image011.jpg (image/jpeg, 26.9 KB) - not displayed
image012.jpg (image/jpeg, 36.1 KB) - not displayed
image013.jpg (image/jpeg, 37.2 KB) - not displayed