Skip to content

Commit e83a5e7

Browse files
authored
Merge pull request #5 from SyncfusionExamples/985360
985360: Updated ReadMe file
2 parents 309c80b + 17471c5 commit e83a5e7

File tree

1 file changed

+24
-13
lines changed

1 file changed

+24
-13
lines changed

README.md

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +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-
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.
4-
## C#
5-
ISnippetFormat keywordFormat = this.editControl1.Language.Add("Keyword");
6-
keywordFormat.FontColor = Color.Red;
7-
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.
86

9-
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.
109

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);
1114

12-
configLex.IsBeginRegex = true;
13-
configLex.IsEndRegex = true;
14-
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";
1519

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

17-
editControl1.Language.Lexems.Add(configLex);
18-
editControl1.Language.ResetCaches();
19-
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)