Stylesheet Development with PTC ALD > Adding PTC ALD Code to Stylesheet Source > Samples > PTC ALD Properties > Set PTC ALD Text Properties > Hyphenation
  
Hyphenation
Hyphenation rules are applied via the Arbortext Styler UI. PTC ALD provides additional options to specify formatting properties for hyphenation.
Change the Hyphen Character
The sample listed here describes how to provide a character that demonstrates a word breaking point, instead of a hyphen.
Refer to sample file Arbortext-path/samples/APP/TextProperties/textProperties.xml. The paragraph in the Changing the hyphen character chapter that has the attribute role=”hyphen character” set references the property set hyphen character in the associated stylesheet. The property set specifies that the pound (#) character should be used as the hyphen character.
The relevant code from the property set is given below:
style.hyphenationCharacter = "#";
This phrase sets the hyphenationCharacter property for the fStyle object that defines text styling. Enter the required character in double quotes.
Number of Widows and Orphan Characters
The sample listed here describes how to control word lengths and widow and orphan settings when hyphenation is active.
Refer to sample file Arbortext-path/samples/APP/TextProperties/textProperties.xml. The paragraph in the Changing hyphenation properties — widow and orphan characters chapter that has the attribute role=”hyphen widows orphans” set references the property set hyphen widows orphans in the associated stylesheet. The property set specifies settings to be used for hyphenation in a paragraph:
The relevant code from the property set is given below:
style.hyphenationCharsBefore = 3;
style.hyphenationCharsAfter = 3;

style.hyphenationCharsMin = 7;
These phrases configure properties for the fStyle object that defines the default styling properties for the paragraph.
hyphenationCharsBefore sets the minimum number of characters from a word that must be left in front of a hyphen
hyphenationCharsAfter sets the minimum number of characters from a word that must be left after a hyphen
hyphenationCharsMin sets the minimum word size that may be hyphenated
Number of Consecutive Hyphens
The sample listed here describes how to specify that a maximum number of consecutive hyphenated lines in a paragraph is permitted.
Refer to sample file Arbortext-path/samples/APP/TextProperties/textProperties.xml. Paragraphs in the Changing hyphenation properties — number of consecutive hyphens chapter include a value for the role attribute, which in turn relate to a condition of the para everywhere else context in the associated stylesheet. Each condition references a different property set to demonstrate the difference between consecutive hyphen settings.
For example, the para context with the attribute value role=”hyphen consec 2” forms the condition ELSE IF attribute "role"= "hyphen consec 2" of para everywhere else in the associated stylesheet. The condition references property set hyphen consec 2 to provide a setting of 1 for maximum consecutive hyphens.
The relevant code from the property set is given below:
style.hyphenationMaxNum = 1;
This phrase sets the hyphenationMaxNum property for the fStyle object that defines the default text styling properties for the paragraph
Note that a setting of 1 means that a line can only by hyphenated if the previous line is not.