XSL-FO Tutorials - Herong's Tutorial Examples - v2.24, by Herong Yang
What Is "character" Formatting Object?
This section describes 'character' formatting object, which is an inline-level formatting object that represents a single character on the output device.
What Is "character" Formatting Object? "character" is an inline-level formatting object that represents a single character on the output device.
An "character" formatting object has no XML content. Its character value is specified by an attribute together with other attributes:
Here is my tutorial example, inline-container-with-Width.fo that has a "block-container" formatting object with width specified:
<?xml version="1.0" encoding="utf-8"?> <!-- character-Formatting-Object.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="4in" page-width="3in"> <fo:region-body region-name="body" background-color="#eeeeee"/> </fo:simple-page-master> </fo:layout-master-set> <fo:page-sequence master-reference="page"> <fo:flow flow-name="body"> <fo:block margin="0.1in" padding="0.2in" border-width="1px" border-style="solid" background-color="#eeffff" color="#000000" font-family="sans-serif" font-size="10pt"> <fo:inline font-size="20pt"> <fo:character character="♠" border-width="1px" border-style="solid" padding-top="5pt"/> <fo:character character="♥" border-width="1px" border-style="solid" padding-top="5pt" color="red"/> <fo:character character="♦" border-width="1px" border-style="solid" padding-top="5pt" color="red"/> <fo:character character="♣" border-width="1px" border-style="solid" padding-top="5pt"/> </fo:inline> Poker is a family of gambling card games. All poker variants involve betting as an intrinsic part of play, and determine the winner of each hand according to the combinations of players' cards, at least some of which remain hidden until the end of the hand. </fo:block> </fo:flow> </fo:page-sequence> </fo:root>
If you process this example XSL-FO document with Apache FOP tool and view the output, you will see that "character" formatting objects are nicely processed into inline areas showing poker suit signs:
Note that you may warning messages as shown below if your system does not support the poker symbol.
... org.apache.fop.events.LoggingEventListener processEvent
WARNING: Glyph "♠" (0x2660, spade) not available in font "Helvetica".
Table of Contents
Apache™ FOP (Formatting Objects Processor)
XSL-FO Document Basics and Examples
Block-Level Formatting Objects
►Inline-Level Formatting Objects
What Are Inline-Level Formatting Objects?
What Is "inline" Formatting Object?
"inline" Splitting for Line Break
What Is "line-height" Attribute?
What Is "baseline-shift" Attribute?
FOP Failed on "block" inside "inline"
What Is "inline-container" Formatting Object?
►What Is "character" Formatting Object?
What Is "leader" Formatting Object?
What Are "page-number*" 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