FOP's Design and Implementation

Simon Pepping

FOP team
Apache Software Foundation

Renaud Richardet

FOP contributor
Apache Software Foundation

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Revision History
Revision 0.x2003, 2004
Various early, partial versions
Revision 1.001 August 2004
Committed to the FOP code repository
Revision 1.0.x2005
Various updates, see the FOP code repository


FOP is a Formatting Object Processor of the Apache project. It aims to provide a standards compliant implementation of XSL-FO. It understands Unicode, has bidirectional writing capabilities, and implements a wide range of rendering formats.

FOP is a work in progress. Its code is under continuing development. This documentation describes the state of the code at the time the documentation was written. At the time you read this documentation the code may be different. Note also that different parts of the documentation were written or revised at different times.

Table of Contents

1. Overview
2. Phase 0: Preparation
1. The preparation process
2. A detailed overview of the objects
3. A detailed overview of the entry methods
3. Phase 1: Building the FO tree
1. Creating the FO nodes
2. Creating the property values
4. Phase 2: Building the Area tree
1. Initiating the layout process
2. Creating the page and body areas
2.1. Overview
2.2. Detailed view
5. Phase 2a: The getNextBreakPoss call tree
1. Overview
2. How do layout managers get layout managers for the child FO nodes?
3. Block layout managers and their child layout managers
4. About getNextBreakPoss and the list of child layout managers
5. LineLayoutManager.getNextBreakPoss
5.1. Prepare for the main loop
5.2. The main loop over the list of child layout managers
5.3. After the main loop
6. LineLayoutManager.makeLineBreak
7. Line LayoutManager, a sequence of breakposs
8. TextLayoutManager.getNextBreakPoss
9. TextLayoutManager.makeBreakPoss
6. Phase 2b: The addAreas call tree
1. Overview
2. Detailed overviews
2.1. PageLM
2.2. FlowLM
2.3. BlockLM1
2.4. LineLM
2.5. TextLM
2.6. BlockLM2
2.7. LineLM
2.8. TextLM
2.9. AddLMVisitor$2
7. Phase 3: Rendering the pages
8. The trees in FOP
1. Overview
2. The tree of BreakPoss
3. Example of an FO and area tree
3.1. The FO file
3.2. The corresponding FO tree
3.3. The corresponding area tree
9. Properties
1. The basic setup of the property subsystem
1.1. Property values
1.2. The property list of an FO node
1.3. Property makers
1.4. Shorthand properties
1.5. Corresponding properties
1.6. Mapping between property names, IDs and makers
1.7. Storing the property values based on their PropID
2. Creating a property value
2.1. General
2.2. Example of a compound property
2.3. Enumerated property values
2.4. Example of a property with keywords
2.5. Parsing a property with an absolute value
3. Retrieving a property value
3.1. Overview
3.2. Detailed overview
3.3. Examples: Retrieving border and padding values
4. Percent-based and mixed property values
4.1. Overview
4.2. Parsing a mixed property value
4.3. Resolving a mixed property value
10. Fonts
1. Font setup
2. Classes and interfaces used in the font package
11. Configuration