Font changing

Posted 8 years ago by Avatar Steve GW
I have tried to look at the doc and examples and I can't seem to find an example of changing the font , or bolding some selected text. I know this is not quite s syntax use model

Is it possible ? I see I just changed the word pssible by adding html tags but I don't want the user see them

[Modified at 12/28/2009 08:18 PM]

Comments (1)

Posted 8 years ago by Actipro Software Support - Cleveland, OH, USA
Hi Steve,

With the new features in 2009.2 you can do this pretty easily. You'd make a tagger that provides IClassificationTag objects. Then you'd make an IClassificationType that is registered with a HighlightingStyle that does a different FontFamilyName or sets Bold = true, etc. Your IClassificationTag's would return an instance of that IClassificationType over the ranges to which it should be applied.

Consider the AdornmentsHighlightWord sample's WordHighlightTagger. This effectively shows how to do it. Just change the style registered in the static constructor to this:
var style = new HighlightingStyle(null, brush);
style.Bold = true;
style.FontFamilyName = "Calibri";
AmbientHighlightingStyleRegistry.Instance.Register(wordHighlightClassificationType, style);
Then you are good to go. If you have a definite list of ranges that should be highlighted this way, you can use a tagger that inherits CollectionTagger instead.

Actipro Software Support
Information The latest build of this product (2017.2 build 0660) was released 16 days ago, which was after the last post in this thread.

Add a Comment

Please log in to a validated account to post comments.