If you specify a type of style to remove,
removeStyles removes any style of that type. It does not look at
the value of the style you specified to remove. For example, if
you specify to remove ITextBoldfaceStyle(true), removeStyles
removes any boldface style whether it is set to true
or false.
offset_type runOffset; length_type runLength; const ITextStyleSet* setPtr; ITextPointSizeStyle size; // Get the styles on the first style run. // The offset and length of the run are returned. setPtr = someText.stylesAt(0, runOffset, runLength) // If the style run contains a point size style, increment its value by 3 if (setPtr.extract(size)) size.setPointSize(size.pointSize() + 3); // If the style run has no point size style, add one else size.setPointSize(6); // Apply the new point size style to the entire style run someText.addStyles(size, runOffset, runLength);
offset_type cursorOffset = 0;
offset_type spanOffset;
length_type spanLength;
ITextStyleSet set;
ITextBoldfaceStyle bold(true);
ITextUnderlinStyle line(true);
while (cursorOffset < someText.length()) {
// If the current character is boldface, underline the entire
style run
if (someText.maximumStyleSpan (cursorOffset, bold,
spanOffset, spanLength))
someText.addStyles(line, spanOffset, spanLength);
cursorOffset += spanLength;
}
You can also use ITextStyleRunIterator to access style runs.
![]()
Styles and Style Sets
Transcoding Classes
Text and
Style Run Iteration
![]()
Iterating through Style Runs in an IText Object