Stylesheet Development with PTC ALD > Adding PTC ALD Code to Stylesheet Source > Samples > PTC ALD Properties > Set PTC ALD Text Properties > Letter and Word Spacing
  
Letter and Word Spacing
PTC ALD can adjust letter and word spacing to provide a more aesthetic appearance for lines that are hyphenated and justified.
Standard line spacing and alignment settings can be configured via the Arbortext Styler UI. PTC ALD provides the additional options stretch and squash for letters and words, which allow each line to be further adjusted as required.
Stretch and Squash
The sample listed here describes how to set letter and word spacing for a paragraph.
Refer to sample file Arbortext-path/samples/APP/TextProperties/textProperties.xml. Each of the paragraphs in the Letter and word spacing chapter includes a value for the role attribute, which in turn relates 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 standard and configured spacing properties.
For example, the para context with the attribute value role=”space 2” forms the condition ELSE IF attribute "role"= "space 2" of para everywhere else in the associated stylesheet. The condition references property set stretch and squash to provide non-standard spacing.
The relevant code from the property set is given below:
style.letterSpaceSquash = "0.5pt";
style.letterSpaceExtra = "0.5pt";

style.wordSpaceSquash = "1pt";
style.wordSpaceExtra = "6pt";
These phrases configure properties for the fStyle object that defines text styling.
The letterSpaceSquash, letterSpaceExtra, wordSpaceSquash, and wordSpaceExtra properties are all based on an fLength datatype object. Each of them have been given explicit measurements as their values.
letterSpaceSquash sets the maximum amount of space that can be removed from letter spacing when justifying a line.
letterSpaceExtra sets the maximum amount of extra space that can be added to letter spacing when justifying a line
wordSpaceSquash sets the maximum amount of space that can be removed from basic word spacing when justifying a line
wordSpaceExtra sets the maximum amount of extra space that can be added to basic word spacing when justifying a line