Yes, if you change properties of existing text styles, it affects all text items linked to this style.
The correct way is searching for the style with the desired properties. If it already exists, use this text style. If not, add a new style to the end of TextStyles.
This work can be done using FindTextStyle method.
For example
Code: Select all
var TextStyle: TFontInfo;
StyleNo: Integer;
TextStyle := TFontInfo.Create(nil);
TextStyle.Assign(Style.TextStyles[0]);
TextStyle.Size := TextSize;
TextStyle.Color := TextColor;
TextStyle.HoverColor := HoverColor;
StyleNo := Style.FindTextStyle(TextStyle);
TextStyle.Free;
Now you can use StyleNo, it refers to a style having necessary properties.
I recommend to study these demos:
http://www.trichview.com/forums/viewtopic.php?t=63
(as far as I remember, they were created before introducing RVStyle.FindTextStyle, they use a more complicated way RVStyle.TextStyles.FindSuchStyle, but the idea is the same)