XSL-FO Tutorials - Herong's Tutorial Examples - v2.25, by Herong Yang
XEP Predefined Font Test
This section provides a tutorial example on how to use RenderX XEP predefined fonts. Adobe Base-14 fonts are not embedded in PDF output. But Windows fonts are embedded.
In the previous section, we learned that RenderX XEP comes with Adobe Base-14 and some Windows fonts predefined in the xep.xml configuration file. Now let's try to use some of them.
Here is my tutorial example, RenderX-XEP-Predefined-Fonts.fo, that uses two fonts predefined in RenderX XEP:
<?xml version="1.0" encoding="utf-8"?> <!-- Renderx-XEP-Predefined-Fonts.fo - Copyright (c) 2006 HerongYang.com. All Rights Reserved. --> <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"> <fo:layout-master-set> <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:simple-page-master> </fo:layout-master-set> <fo:page-sequence master-reference="page"> <fo:flow flow-name="body" font-size="12pt"> <fo:block margin-top="6pt">sans-serif font: <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:inline> </fo:block> <fo:block margin-top="6pt">Tahoma font: <fo:inline background-color="#ffddff" font-family="Tahoma" font-weight="bold"> The tangram is a dissection puzzle consisting of seven flat shapes, called tans, which are put together to form shapes. </fo:inline> </fo:block> </fo:flow> </fo:page-sequence> </fo:root>
If you process this example XSL-FO document with RenderX XEP tool to generate a PDF file, you should not see any errors:
herong> \Progra~1\RenderX\XEP\xep \ -fo RenderX-XEP-Predefined-Fonts.fo \ -pdf RenderX-XEP-Predefined-Fonts_xep.pdf (document [system-id file:/C:/herong/RenderX-XEP-Predefined-Fonts.fo] (validate [validation OK]) (compile (masters (sequence-master [master-name page])) (sequence [master-reference page] (flow [flow-name body]))) (format (sequence [master-reference page] (flow [1]) (static-content [1]))) (generate [output-format pdf][1]))
If you open the PDF output file, RenderX-XEP-Predefined-Fonts_xep.pdf, in Adobe Acrobat Reader, you will see two blocks of text displayed in two fonts. Tahoma font is obviously thicker (or bolder) than sans-serif.
If you click File > Properties > Fonts, you will see 3 fonts are used in this PDF file:
The picture below shows you the font differences and the font property list in Acrobat Reader:
Table of Contents
Apache™ FOP (Formatting Objects Processor)
XSL-FO Document Basics and Examples
Block-Level Formatting Objects
Inline-Level Formatting Objects
Including Graphics in XSL-FO document
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