Skip to content

Commit 17471c5

Browse files
authored
Update README.md
1 parent f069cb1 commit 17471c5

File tree

1 file changed

+24
-14
lines changed

1 file changed

+24
-14
lines changed

README.md

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,30 @@
1-
# This document describes how to change the font size of editor texts after config.xml file has been loaded
1+
# How to Change the Font Size of Editor Texts After config.xml Has Been Loaded
2+
## Overview
3+
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.
24

3-
This repository explains how to modify the font size of editor texts after the config.xml file has been loaded in a syntax editor control. The customization of text appearance in the editor 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.
4-
For example, in a C# application, you can define a custom format for keywords using ISnippetFormat. You can set the font color to red and apply an italic style with a specific font size. Then, using ConfigLexem, you can define a regular expression pattern to match keywords and associate it with the custom format. This lexem is added to the language configuration, and the editor caches are reset to apply the changes.
5-
## C#
6-
ISnippetFormat keywordFormat = this.editControl1.Language.Add("Keyword");
7-
keywordFormat.FontColor = Color.Red;
8-
keywordFormat.Font = new Font(FontFamily.GenericSansSerif, 14,FontStyle.Italic);
5+
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.
96

10-
ConfigLexem configLex = new ConfigLexem("[A-Z]+", "", FormatType.Custom, false);
7+
## Example: C# Implementation
8+
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.
119

10+
``` C#
11+
ISnippetFormat keywordFormat = this.editControl1.Language.Add("Keyword");
12+
keywordFormat.FontColor = Color.Red;
13+
keywordFormat.Font = new Font(FontFamily.GenericSansSerif, 14, FontStyle.Italic);
1214

13-
configLex.IsBeginRegex = true;
14-
configLex.IsEndRegex = true;
15-
configLex.FormatName = "Keyword";
15+
ConfigLexem configLex = new ConfigLexem("[A-Z]+", "", FormatType.Custom, false);
16+
configLex.IsBeginRegex = true;
17+
configLex.IsEndRegex = true;
18+
configLex.FormatName = "Keyword";
1619

20+
editControl1.Language.Lexems.Add(configLex);
21+
editControl1.Language.ResetCaches();
22+
```
1723

18-
editControl1.Language.Lexems.Add(configLex);
19-
editControl1.Language.ResetCaches();
20-
24+
## Key Steps
25+
- Create a custom format using ISnippetFormat.
26+
- Define a Lexem with a regex pattern to match specific text (e.g., keywords).
27+
- Associate the Lexem with the custom format.
28+
- Add the Lexem to the language configuration.
29+
- Reset the editor caches to apply the changes.
30+

0 commit comments

Comments
 (0)