On 07/31/2017 08:10 AM, 梅隆魁 wrote:
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

NPEKKUBE~(XA_HV`2C%))55
2、Chinese“楷体”for codes

N{MM2LB%EG9BZDXORMPY3I7
3、Chinese“SimSun”for the main body

32EYIL7G((FRYJCN{RI@}SC

4、Microsoft YaHei for the bold chapter title

4V9]GWCE$EJGJ3@_$GNXFO3




I looked at your screenshots and found that you did almost the right thing.

In order to convert Chinese/Russian DocBook to PDF you must!

A) map all the following fonts (no less, no more!):

1) serif, normal, bold, italic, bold-italic, (oblique not useful!)
2) sans-serif, normal, bold, italic, bold-italic,
3) monospace, normal, bold, italic, bold-italic.

and B) VERY IMPORTANT: do NOT attempt to change any of the font-families used by the XSLT stylesheets by setting parameters like body.font.family (http://docbook.sourceforge.net/release/xsl/current/doc/fo/body.font.family.html), title.font.family (http://docbook.sourceforge.net/release/xsl/current/doc/fo/title.font.family.html), etc.

Because, if you also specify some XSLT stylesheets font.family parameters like you seem to have done, suddenly this becomes very complicated!

This is done in XMLmind XML Editor and XMLmind XSL Utility once for all. After that, all your Chinese DocBook documents should convert fine to PDF.



For (1), your Chinese“黑体” mapping is fine. (You could also use your Chinese “SimSun” mapping, but in this case, you'll have to add serif-bold, serif-italic, serif-bold-italic.)

For (2), your Microsoft YaHei mapping is missing sans-serif-bold-italique

For (3), your Chinese“楷体” mapping is missing monospace-bold, monospace-italic, monospace-bold-italic.




Please complement your mappings as explained above, remove oblique and useless mappings, and VERY IMPORTANT: remove all the XSLT stylesheets parameters related to fonts and you'll be done for the years to come.











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



This level of support is reserved to our customers. However, I'll answer your question to prove our good will.



The mappings you made created a "fop.conf" file found in directory "XXE_user_preferences_dir/fop/", where "XXE_user_preferences_dir/" is:

    * $HOME/.xxe7/ on Linux.

    * $HOME/Library/Application Support/XMLmind/XMLEditor7/ on the Mac.

    %APPDATA%\XMLmind\XMLEditor7\ on Windows XP, Vista, 7, 8 and 10.

Example: C:\Documents and Settings\john\Application Data\XMLmind\XMLEditor7\ on Windows XP. C:\Users\john\AppData\Roaming\XMLmind\XMLEditor7\ on Windows Vista, 7, 8 and 10.

If you cannot see the "Application Data" directory using Microsoft Windows File Manager, turn on Tools>Folder Options>View>File and Folders>Show hidden files and folders.

See http://www.xmlmind.com/xmleditor/_distrib/doc/configure/anatomy_of_a_config.html#xxe_user_preferences_dir

The idea is to package your "fop.conf" as an XMLmind XML Editor add-on so you can redistribute it to other users.



Procedure (assuming you created "XXE_user_preferences_dir/fop/fop.conf" using "Options|Preferences", "Add-on|FOP" like you did it).

1) Create a "customize.xxe" file (see attached file) in a subdirectory of "XXE_user_preferences_dir/addon/". Let's call this subdirectory "chinese_fop/".

2) Copy your "XXE_user_preferences_dir/fop/fop.conf" to "XXE_user_preferences_dir/addon/chinese_fop/".

3) Add this property to file "customize.xxe":

---
<property name="XXE_FOP_CONFIG" url="true">fop.conf</property>
---

(References:
* http://www.xmlmind.com/xmleditor/_distrib/doc/configure/property.html
* http://www.xmlmind.com/xmleditor/_distrib/doc/help/system_properties.html#XXE_FOP_CONFIG
)

4) Delete folder "XXE_user_preferences_dir/fop/" as it is no longer needed (and as it now gets in the way).

5) Delete folder XXE_user_preferences_dir/cache/" to force XMLmind XML Editor discover your "customize.xxe" file.

6) Restart XMLmind XML Editor and test that it still works.

7) Subdirectory "chinese_fop/" is now ready to be packaged as a (redistributable) add-on.

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


<?xml version='1.0' encoding='ISO-8859-1'?>
<configuration 
  xmlns="http://www.xmlmind.com/xmleditor/schema/configuration";
  xmlns:cfg="http://www.xmlmind.com/xmleditor/schema/configuration";>

  <property name="XXE_FOP_CONFIG" url="true">fop.conf</property>

</configuration>
--
XMLmind XML Editor Support List
xmleditor-support@xmlmind.com
http://www.xmlmind.com/mailman/listinfo/xmleditor-support

Reply via email to