
Hyphenation / language settings
This page was automatically translated. Stay tuned for a human translation…
Hyphenation is necessary in most Western languages to have an acceptable appearance for narrow texts. Hyphenation is an integral part of the line breaking algorithm, for example to avoid multiple hyphenations in consecutive lines.
Hyphenation is controlled by language in the Publisher and is pattern-based. The language can be set globally via <Options mainlanguage="…">
or paragraphwise.
<Options mainlanguage="German" />
switches the entire document to German hyphenation patterns, while
<Paragraph language="German">
<Value>Autobahn</Value>
</Paragraph>
changes the language for only one paragraph. The available languages are described in the command reference under <Options>
.
Alternatively to the written out names like German
, the language code can be used.
The two examples above can also be used as follows:
<Options mainlanguage="de" />
<Paragraph language="de">
<Value>Autobahn</Value>
</Paragraph>
If you want to test if the words are hyphenated correctly, you can create small marks with <Trace hyphenation="yes" />
.
<Layout
xmlns="urn:speedata.de:2009/publisher/en"
xmlns:sd="urn:speedata:2009/publisher/functions/en">
<Options mainlanguage="German" />
<Trace hyphenation="yes" />
<Record element="data">
<PlaceObject>
<Textblock width="3">
<Paragraph>
<Value>Autobahn</Value>
</Paragraph>
</Textblock>
</PlaceObject>
</Record>
</Layout>
results in the following:
Via
<Hyphenation>er-go-no-mic</Hyphenation>
you can define hyphenation suggestions or exceptions for individual words. In this way, the words are then only hyphenated at the positions indicated by a hyphen.
With optical margin alignment, which is described in the section Optical margin alignment, you can reduce the number of hyphenations in the document somewhat. |
Turn off paragraph hyphenations
For single paragraphs you can switch off the automatic hyphenation by defining a text format with hyphenate="no"
.
<DefineTextformat name="nohyphen" hyphenate="no"/>
No words are hyphenated in paragraphs marked in this way. The use of text formats is described in a separate section.
The hyphenation character can also be changed using a text format:
<DefineTextformat name="dothyphen" hyphenchar="•"/>
Allow hyphenations only on certain characters
A property of <Paragraph>
allows to limit the characters where a line break may be inserted. This is often important for technical data where, for example, type designations in the form 12-345/AB
occur and should not be hyphenated. In the following example, a line break may only be inserted after a slash:
<Paragraph allowbreak="/">
<Value>https://download.speedata.de/publisher/development/</Value>
</Paragraph>
The default setting for allowbreak is “ -”, i.e. a break at a space or hyphen.
This is an experimental feature in the Publisher. It is likely to be associated with a text format in a future version. |
Language settings for non-western languages
Some languages have special typesetting rules that do not affect hyphenation, but the appearance of the text. So the characters can change their shape or position, depending on where they are in the word. To use this feature, the following conditions must be met:
-
mode="harfbuzz"
must be activated at<LoadFontfile>
. -
The language must be set correctly. If the language is not available in the list of supported languages,
Other
or--
(two dashes) must be used. - The selected font must contain the appropriate characters.
<Layout xmlns="urn:speedata.de:2009/publisher/en"
xmlns:sd="urn:speedata:2009/publisher/functions/en"
version="4.1.7">
<LoadFontfile name="NotoSansBengali-Regular"
filename="NotoSansBengali-Regular.ttf"
mode="harfbuzz" />
<DefineFontfamily fontsize="10" leading="12" name="text">
<Regular fontface="NotoSansBengali-Regular" />
</DefineFontfamily>
<Record element="data">
<PlaceObject>
<Textblock>
<Paragraph>
<!-- No language set, wrong output! -->
<Value>আমি</Value>
</Paragraph>
</Textblock>
</PlaceObject>
</Record>
</Layout>
<PlaceObject>
<Textblock>
<Paragraph language="Other">
<Value>আমি</Value>
</Paragraph>
</Textblock>
</PlaceObject>