I have a Java program that generates an XML file, which is rendered in to a PDF. The problem is that I can't seem to get the hyphenation to work.
I've read trough https://www.w3.org/TR/xsl/#d0e26492 briefly but I still don't understand why I can't get my text to hyphenate. I've tried inserting hyphenate="true"
in nearly all blocks but strings such as "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA..." still go out of bounds. I've tried to set language
and locale
too but I don't really care where the hyphenation happens, anywhere would be fine.
Hyphenation is usually based on a hyphenation dictionary and/or an algorithm that matches known sequences of letters and breaks words only where it is allowed. Different languages have different hyphenation conventions, and even US English and British English have differences.
Strings like "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA..." are unlikely to match anything in a hyphenation dictionary, so the implementation doesn't know where to break the "word".
You probably want something like some of the solutions proposed for breaking text in table cells; for example: