You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. Hyphenation
  2. FOP uses Liang's hyphenation algorithm, well known from TeX. It needs
  3. language specific patterns and other data for operation.
  4. Because of licensing issues (and for convenience), all hyphenation
  5. patterns for FOP are made available through the Objects For Formatting
  6. Objects project <http://offo.sourceforge.net/hyphenation/index.html>.
  7. To install a custom hyphenation pattern for use with FOP:
  8. 1. Convert the TeX hyphenation pattern file to the FOP format. The FOP
  9. format is an xml file conforming to the DTD found at
  10. {fop-dir}/hyph/hyphenation.dtd.
  11. The most important source of TeX hyphenation pattern files is the
  12. CTAN TeX Archive
  13. <http://www.ctan.org/tex-archive/language/hyphenation/>.
  14. 2. Name this new file following this scheme:
  15. languageCode_countryCode.xml. The country code is optional, and
  16. should be used only if needed. For example:
  17. - en_US.xml would be the file name for American English hyphenation
  18. patterns,
  19. - it.xml would be the file name for Italian hyphenation patterns.
  20. The language and country codes must match the XSL-FO input, which
  21. follows ISO 639
  22. <http://www.ics.uci.edu/pub/ietf/http/related/iso639.txt>
  23. (languages) and ISO 3166
  24. <http://www.ics.uci.edu/pub/ietf/http/related/iso3166.txt>
  25. (countries).
  26. NOTE: The ISO 639/ISO 3166 convention is that language names are
  27. written in lower case, while country codes are written in upper
  28. case.
  29. FOP does not check whether the language and country specified in
  30. the FO source are actually from the current standard, but it relies
  31. on it being two letter strings in a few places. So you can make up
  32. your own codes for custom hyphenation patterns, but they should be
  33. two letter strings too (patches for proper handling extensions are
  34. welcome)
  35. 3. There are basically three ways to make the FOP-compatible
  36. hyphenation pattern file(s) accessible to FOP:
  37. a. Download the precompiled JAR from OFFO
  38. <http://offo.sourceforge.net/hyphenation/index.html> and place it
  39. either in the {fop-dir}/lib directory, or in a directory of your
  40. choice (and append the full path to the JAR to the environment
  41. variable FOP_HYPHENATION_PATH).
  42. b. Download the desired FOP-compatible hyphenation pattern file(s) from
  43. OFFO <http://offo.sourceforge.net/hyphenation/index.html>, and/or
  44. take your self created hyphenation pattern file(s),
  45. - place them in the directory {fop-dir}/hyph,
  46. - or place them in a directory of your choice and set the Ant
  47. variable user.hyph.dir to point to that directory (in
  48. build-local.properties),
  49. and run Ant with build target jar-hyphenation. This will create a
  50. JAR containing the compiled patterns in {fop-dir}/build that will
  51. be added to the classpath on the next run.
  52. When FOP is built from scratch, and there are pattern source
  53. file(s) present in the directory pointed to by the user.hyph.dir
  54. variable, this JAR will automatically be created from the supplied
  55. pattern(s).
  56. c. Put the pattern source file(s) into a directory of your choice and
  57. configure FOP to look for custom patterns in this directory, by
  58. setting the hyphenation-dir configuration option.
  59. Either of these three options will ensure hyphenation is working
  60. when using FOP from the command-line. If FOP is being embedded,
  61. remember to add the location(s) of the hyphenation JAR(s) to the
  62. CLASSPATH (option 1 and 2) or to set the hyphenation-dir
  63. configuration option programmatically (option 3).
  64. If you would like to build your own hyphenation pattern files, or
  65. modify existing ones, the section entitled 'Hyphenation Patterns' of
  66. the 'FOP: Hyphenation' page at the FOP web site
  67. <http://xmlgraphics.apache.org/fop/hyphenation.html#patterns> will
  68. help you understand how to do so. Even when creating a pattern file
  69. from scratch, it may be beneficial to start with an existing file and
  70. modify it. See OFFO's Hyphenation page
  71. <http://offo.sourceforge.net/hyphenation/index.html> for examples.
  72. If you have made improvements to an existing FOP hyphenation pattern,
  73. or if you have created one from scratch, please consider contributing
  74. these to OFFO so that they can benefit other FOP users as well.
  75. Please inquire on the FOP User mailing list.