Configuring SimHei Font for Chinese Characters

This section provides a tutorial example on how to configure RenderX XEP with SimHei font family to support Chinese characters.

Now let's see how we can add configuration settings for a new font to RenderX XEP. The goal is to add a font to support Chinese characters.

1. Run Windows Character Map tool to find a font that support Chinese characters:

herong> charmap

2. On the Character Map window, select "SimHei" from the font dropdown list. Then scroll down on the character list to confirm Chinese characters are supported.

3. Locate the SimHei font file:

herong> dir \windows\Fonts\sim*.*

06/10/2009  05:25 PM        10,576,012 simfang.ttf
06/10/2009  05:25 PM         9,751,960 simhei.ttf
06/10/2009  05:25 PM        11,785,184 simkai.ttf
06/10/2009  05:25 PM           116,376 simpbdo.ttf
06/10/2009  05:25 PM           104,884 simpfxo.ttf
06/10/2009  05:25 PM           124,628 simpo.ttf
06/10/2009  05:25 PM        15,323,200 simsun.ttc
06/10/2009  05:25 PM        15,406,288 simsunb.ttf

4. Open RenderX XEP configuration file \proga~1\RenderX\XEP\xep.xml. Then add the following settings to define SimHei font family:

<fonts ...>
<font-group xml:base="file:/C:/Windows/Fonts/" 
 label="Windows TrueType" embed="true" subset="true">
 <font-family name="Arial">
  <font-family name="SimHei" embed="true">
   <font><font-data ttf="simhei.ttf"/></font>
   <font style="italic"><font-data ttf="simhei.ttf"/></font>
   <font weight="bold"><font-data ttf="simhei.ttf"/></font>
   <font weight="bold" style="italic">
    <font-data ttf="simhei.ttf"/>

5. Use the following tutorial example,, to verify the configuration:

<?xml version="1.0" encoding="utf-8"?>
 - Copyright (c) All Rights Reserved.
<fo:root xmlns:fo="">
  <fo:simple-page-master master-name="page" 
   margin="0.1in" page-height="4.4in" page-width="3.4in">
   <fo:region-body region-name="body"/>
 <fo:page-sequence master-reference="page">
  <fo:flow flow-name="body" font-size="10pt">
<fo:block margin-top="6pt">English letters:
 <fo:inline background-color="#ffddff" 
  font-family="sans-serif" font-weight="bold">
The tangram is a dissection puzzle consisting of seven flat shapes, 
called tans, which are put together to form shapes.
<fo:block margin-top="6pt">Chinese characters:
 <fo:inline background-color="#ffddff" 
  font-family="SimHei" font-weight="bold">

If you process this example XSL-FO document with RenderX XEP tool to generate a PDF file, you will see no errors. If you open the PDF output file, Chinese characters are formatted correctly:

RenderX XEP Output with SimHei Chinese Font
RenderX XEP Output with SimHei Chinese Font

Notice that I used font-weight="bold", but Chinese characters in the output are not really bolded. This is because I defined the bold font to go to the normal font file, simhei.ttf, in xep.xml. I need to find the SimHei bold font file to fix the problem.

Table of Contents

 About This Book

 Introduction of XSL-FO

 Apache™ FOP (Formatting Objects Processor)

 RenderX XEP as an XSL-FO Tool

 Introduction of Area Model

 XSL-FO Document Basics and Examples

 Page Layout Masters

 Block-Level Formatting Objects

 Inline-Level Formatting Objects

 Including Graphics in XSL-FO document

 Table of Rows and Columns

 List, Item, Label, and Body

 Floating Blocks - "float" and "footnote"

 Hyperlinks, Table of Contents and Indexes

 Headers and Footers using "static-content"

 Font Attributes and Font Families

 Apache FOP Font Configurations

RenderX XEP Font Configurations

 XEP Font Configuration Settings

 XEP Predefined Font Test

Configuring SimHei Font for Chinese Characters


 Full Version in PDF/ePUB