PTC ALD in Arbortext Styler > Components of Documents and Templates > Style Components > Rules > Text Rules
  
Text Rules
The fStyle.underlineRule, fStyle.overlineRule and fStyle.strikethroughRule properties use text rules to specify the appearance of the rule being applied. The fTextRule object extends the set of common rule properties with additional properties that control how the rule behaves on a line:
fTextRule.offset — specifies the distance from the text baseline at which rules are drawn
By default, underlines appear just below the baseline, strikethrough rules appear through the middle of the text, and overlines appear over the top of text. This property can override the default placement for the specified rule type.
Positive offset values push the rule down the page. Negative values move the rule upwards.
fTextRule.wordsOnly — specifies that underline and strikethrough rules apply only to the words and are not drawn on the spaces
By default, this property is deactivated.
fTextRule.repeatPattern — determines whether start and end patterns should be repeated on each fragment of a line
When applying a rule to words only, PTC Arbortext Layout Developer draws several small fragments of a line. Each fragment can be considered an individual rule. The start and end patterns configured for the rule are output on each fragment. This property deactivates that functionality. The start and end patterns are only applied when the rule is turned on and off.
fTextRule.mode — specifies when the rule should be drawn
By default, text rules are drawn on top of text. This property allows the rule to be drawn beneath the text. Valid values are represented in the fTextRule.RuleMode constant.
fTextRule.drawMode — determines the extent of the boundary in which to draw the rule
By default, PTC Arbortext Layout Developer sets the rule’s position based on the text height and leading values that are effective at the end of the current line. Text can vary in height on a line. This property controls how the rule behaves when these variations are encountered. The fTextRule.RuleDrawMode constant provides the possible values, for example using the maximum height on the line, tracking the text height changes, and tracking leading changes.
fTextRule.show — activates and deactivates the configured rule
Properties for the rule can be set up on the fStyle object applied to the text. This property allows the rule to be turned on and off with a single command rather than having to set up the rule every time it is used.
These examples show how the properties for a text rule can be configured on the default style of a block and then applied to an element in the block.
To define the style:
var b = new fBlock();
var s = b.defaultStyle;

s.underlineRule.color = "red";
s.underlineRule.thickness = "2pt";
s.underlineRule.lineStyle = fRuleLine.LINE_SMOOTHWAVE;
Then, to activate the rule on the element that starts the underline:
formatting.currentStyle.underlineRule.show = true;
To deactivate the rule:
formatting.currentStyle.underlineRule.show = false;