How to install hyphenation patterns in FOP?

Asked by Jerzy Jalocha N on 2009-11-04

In order to use hyphenation with the FOP processor, what files do I have to install, and how do I tell FOP where they are installed?

I think, I have tried all possible combinations, without success.

In the following sample usage scenario:
/home/work/source.fo
/home/work/hyphenation/fop-hyph.jar

 * The 'source.fo' file contains hyphenate="true" and language="en" and language="es" attributes where necessary.
 * The fop-hyph.jar file was downloaded from the 'offo-hyphenation-fop-stable_v1.2.zip' archive from Sourceforge.

The following instructions do not work. They produce "Couldn't find hyphenation pattern en" and "es" messages.

$ export FOP_HYPHENATION_PATH=/home/work/hyphenation/fop-hyph.jar
$ fop source.fo result.pdf

$ export CLASSPATH=$CLASSPATH:/home/work/hyphenation/fop-hyph.jar
$ fop source.fo result.pdf

I also tried other paths, such as 'hyphenation/fop-hyph.jar', 'hyphenation' './hyphenation/fop-hyph.jar', etc.

I also tried putting the FOP_HYPHENATION_PATH variable in a /home/work/.foprc file without success.

The documentation also tells me to install the 'fop-hyph.jar' in a "lib directory of the your FOP installation" or in a "build directory of the your FOP installation". But I can't find such directories.

Since the documentation also mentions a 'hyphenation-base' configuration parameter, I tried putting absolute and relative paths to 'fop-hyph.jar' and 'hyphenation' in a '/home/work/hyphenation/fop.xconf' file. But I only got huge error messages.

I also downloaded the 'offo-hyphenation_v1.2.zip' archive from Sourceforge, and tried to point the 'hyphenation-base' parameter to the 'en.xml' and 'es.xml' files, but FOP complained about missing '*.hyp' files.

I have honestly tried to read and understand the available documentation:
 * http://xmlgraphics.apache.org/fop/0.95/hyphenation.html
 * http://xmlgraphics.apache.org/fop/faq.html#hyphenation-fails
 * http://xmlgraphics.apache.org/fop/0.95/configuration.html
 * http://offo.sourceforge.net/hyphenation/

Any help is really appreciated.
Thanks!

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu fop Edit question
Assignee:
No assignee Edit question
Solved by:
Jerzy Jalocha N
Solved:
2009-11-09
Last query:
2009-11-09
Last reply:
2009-11-04
Onkar Shinde (onkarshinde) said : #1

I am curious now. What is version of Ubuntu and fop that you are using?

Jerzy Jalocha N (jjalocha) said : #2

Sorry, Onkar, I forgot to post that information:
 * Xubuntu 9.06 Jaunty Jackalope
 * linux-image-2.6.28-16-generic (ix86)
 * FOP 1:0.95.dfsg-2ubuntu1
 * Both Sun Java and GCJ seem to be installed, so I am not sure which one is running. Here is the output of 'java -version':
java version "1.6.0_16"
Java(TM) SE Runtime Environment (build 1.6.0_16-b01)
Java HotSpot(TM) Client VM (build 14.2-b01, mixed mode, sharing)

Jerzy Jalocha N (jjalocha) said : #3

I finally got help on the FOP mailing list.

The FOP_HYPHENATION_PATH doesn't work in Ubuntu, probably due to some error in the /usr/bin/fop script. (See http://www.mail-archive.com/fop-users%40xmlgraphics.apache.org/msg14023.html)

But the following scenario does work correctly:

/home/work/source.fo
/home/work/hyphenation/fop-hyph.jar

$ export JAVA_CLASSPATH=$JAVA_CLASSPATH:/home/work/hyphenation/fop-hyph.jar
$ fop source.fo result.pdf

If you prefer, you could put the patterns in /usr/local/lib/java/fop-hyph.jar, and the export instruction in ~/.bash_profile or ~/.bashrc.

Onkar Shinde (onkarshinde) said : #4

I missed the previous information you provided because I was not subscribed to the question.

The version of fop you are using has the old launcher script. I was referring to the version in karmic which has proper launcher script. It should be easy to install the version from karmic. If you can not install it for some reason then I will attach the script in bug. I will also try to get this fixed in a jaunty-updates.

Jerzy Jalocha N (jjalocha) said : #5

Don't worry, Onkar!
This hyphenation stuff is just a detail, and I am not in hurry with this either.
Thanks for caring!