Installation of FOP XML Hyphenation Patterns

Installation of FOP XML Hyphenation Patterns

The XML hyphenation patterns must be compiled by FOP before they can be used. Proceed as follows:

  • Place the XML hyphenation patterns in the directory {fop-dir}/hyph,
  • or place them in a directory of your choice and set the Ant variable user.hyph.dir to point to that directory (in,

Then run Ant with build target jar-hyphenation. This will create a JAR containing the compiled patterns in {fop-dir}/build that will be added to the classpath on the next run. If you get a StackOverflowError, you must increase the stack size by setting the Ant variable hyph.stacksize to a higher value, e.g. 1024k.

When FOP is built from scratch, and there are pattern source file(s) present in {fop-dir}/hyph, this JAR will automatically be created from the supplied pattern(s) by the build target package.

See also the hyphenation page of FOP's web site.

Configuring FOP for hyphenation

In most cases no configuration is required. You need to add special configuration if you want FOP to use a different pattern than its default.

By default, FOP searches for a pattern named ll if you specify language="ll" in your FO file. FOP searches for a pattern named ll_CC if you specify language="ll" country="CC" in your FO file; if that does not exist, FOP searches for a pattern named ll.

You may want to use a different hyphenation pattern, e.g. de_1901 instead of de, or en_GB instead of en (which is the US version) for Indian English. You configure this by adding a hyphenation-pattern element to your configuration file. It has an attribute lang and an optional attribute country. Its content is the base name of the hyphenation pattern file to use for that language and country. See also the configuration page for FOP of FOP's web site. Example:

  • <hyphenation-pattern lang="de">de_1901</hyphenation-pattern>
  • <hyphenation-pattern lang="en" country="IN">en_GB</hyphenation-pattern>

Note that configuration can be used as of version 1.1 of FOP.