Forum How do I...?

hyphenation customizations


I have looked for documentation on how to customize my hyphenation dictionary, and I haven't found anything.

Here's what I've been doing: I've copied the hyphenation dictionary called "hyph-en-us.pat" into the folder with my content and pointed to this file in the CSS with the "prince-hyphenation-patterns" property. When I find something I want to customize, I go into the hyph-en-us.pat file and add a pattern. Given how complex this pattern document is, though, I'm always worried about fouling up other patterns by adding/removing. Is this the best way to customize my hyphenation patterns or is there a better way? I've found very little instruction on how to properly edit this document (just enough to think I know what I'm doing). Any suggestions?

I do like keeping the pattern dictionary with the content because it is all SVN-controlled, but if there is a better way to add custom hyphenation patterns, I'd love to hear about it.


This is probably the best way for the time being, yes. Customising your own hyphenation dictionary is still a bit of a black art. We may be able to simplify this with some kind of JavaScript API in the future, we'll see.

I have installed prince xml in local environment in ubuntu.

The hyphenation property works in local environment for tamil language when i add the below line in styles.css in prince source folder of style.

:lang(ta) { prince-hyphenate-patterns: url("../hyph/hyph-ta.pat"); }

and copied the file hyph-ta.pat to hyph folder in prince source folders.

And I have also using Docraptor API for generating documents.In that documents Hyphenation not working even when i added the below line in html content's style property

:lang(ta) { prince-hyphenate-patterns: url("../hyph/hyph-ta.pat");}

Is there any other requirements needed to work the hyphenation in Docraptor API ?

Thank You.

I guess you will need to specify a HTTP URL for the hyphenation dictionary, or consult DocRaptor support.

Even though I changed the prince-hyphenate-patterns url to HTTP URL hyphenation not working .This is my document URL.

Thank you
  1. sampledoc.html7.2 kB
    document content

Edited by sakthikanth

Hi ,

Could you please let me know if remote urls work for connecting a hyphenation dictionary in PrinceXML 12?

The current document indicates only local paths:
Sorry, you are quite right: Prince does not support remote HTTP URLs for hyphenation dictionaries yet!
The latest builds now support loading hyphenation dictionaries from HTTP URLs, sorry it took so long. :)