[ExtendScript] Cannot change `underline` value of some text ranges.
We cannot successfully set characterAttribute.underline to false
in some textRanges.
(MacOS 15.0 Adobe Illustrator 28.7.1)
Steps to reproduce:
1. New document
2. Make a text frame with contents "ab"
3. Set the "b" to a different fontStyle, eg. "italic"
4. Run the below script, and check the console output.
Expected Result: all tests PASSED, meaning that the underline can be set to true and then to false successfully.
Actual result, test B on the "b" fails.
Script:
```
(function () {
var doc = app.activeDocument,
tf = doc.textFrames[0];
var results = ['Results:'];
tf.textRanges[0].characterAttributes.underline = true
results.push('textRanges[0] test A: ' + (true === tf.textRanges[0].characterAttributes.underline ? 'PASSED' : 'FAILED'));
tf.textRanges[0].characterAttributes.underline = false;
results.push('textRanges[0] test B: ' + (false === tf.textRanges[0].characterAttributes.underline ? 'PASSED' : 'FAILED'));
tf.textRanges[1].characterAttributes.underline = true;
results.push('textRanges[1] test A: ' + (true === tf.textRanges[1].characterAttributes.underline ? 'PASSED' : 'FAILED'));
tf.textRanges[1].characterAttributes.underline = false;
results.push('textRanges[1] test B: ' + (false === tf.textRanges[1].characterAttributes.underline ? 'PASSED' : 'FAILED'));
alert(results.join('\n'));
})();
```
See this community forum post.
Update: User sttk3 discovered that the bug is actually that Illustrator ignores an attempt to set a characterAtrribute property if the value is the same as the applied character style's value for the same attribute.