diff --git a/README.md b/README.md index 7613451..680a3d0 100644 --- a/README.md +++ b/README.md @@ -1,19 +1,30 @@ -# This document describes how to change the font size of editor texts after config.xml file has been loaded +# How to Change the Font Size of Editor Texts After config.xml Has Been Loaded +## Overview +This repository demonstrates how to modify the font size of editor texts in a syntax editor control after the config.xml file has been loaded. -We can change the font style, font family, font size and font color of editor texts using ISnippetFormat and Lexems by deriving the language used and changing the above-mentioned properties of font and adding that Lexems for that language in config.xml. -## C# - ISnippetFormat keywordFormat = this.editControl1.Language.Add("Keyword"); - keywordFormat.FontColor = Color.Red; - keywordFormat.Font = new Font(FontFamily.GenericSansSerif, 14,FontStyle.Italic); +Customization of text appearance is achieved using the ISnippetFormat interface and Lexems, which allow developers to define how specific language elements should be displayed. By identifying the language used in the editor and applying formatting properties such as font style, font family, font size, and font color, developers can enhance the readability and visual appeal of code snippets. - ConfigLexem configLex = new ConfigLexem("[A-Z]+", "", FormatType.Custom, false); +## Example: C# Implementation +In a C# application, you can define a custom format for keywords using ISnippetFormat. For instance, you can set the font color to red, apply an italic style, and specify a font size. Then, using ConfigLexem, you define a regular expression pattern to match keywords and associate it with the custom format. +``` C# +ISnippetFormat keywordFormat = this.editControl1.Language.Add("Keyword"); +keywordFormat.FontColor = Color.Red; +keywordFormat.Font = new Font(FontFamily.GenericSansSerif, 14, FontStyle.Italic); - configLex.IsBeginRegex = true; - configLex.IsEndRegex = true; - configLex.FormatName = "Keyword"; +ConfigLexem configLex = new ConfigLexem("[A-Z]+", "", FormatType.Custom, false); +configLex.IsBeginRegex = true; +configLex.IsEndRegex = true; +configLex.FormatName = "Keyword"; +editControl1.Language.Lexems.Add(configLex); +editControl1.Language.ResetCaches(); +``` - editControl1.Language.Lexems.Add(configLex); - editControl1.Language.ResetCaches(); - +## Key Steps +- Create a custom format using ISnippetFormat. +- Define a Lexem with a regex pattern to match specific text (e.g., keywords). +- Associate the Lexem with the custom format. +- Add the Lexem to the language configuration. +- Reset the editor caches to apply the changes. +