Represents a run of text that should be drawn with the same style.
More...
|
static IEnumerable< FormattedText > | Format (string text, Font normalFont, Font boldFont, Font italicFont, Font boldItalicFont, Brush defaultBrush=null, TextSpacing? spacing=null) |
| Parse the formatting information contained in a text string into a collection of FormattedText objects. More...
|
|
static IEnumerable< FormattedText > | Format (string text, FontFamily.StandardFontFamilies fontFamily, double fontSize, bool defaultUnderline=false, Brush defaultBrush=null, TextSpacing? spacing=null) |
| Parse the formatting information contained in a text string into a collection of FormattedText objects, using fonts from a standard font family. More...
|
|
|
string | Text [get] |
| Represents the text represented by this instance. More...
|
|
Font | Font [get] |
| Represents the font that should be used to draw the text. More...
|
|
Script | Script [get] |
| Represents the position of the text. More...
|
|
Brush | Brush [get] |
| Represents the brush that should be used to draw the text. If this is null, the default brush is used. More...
|
|
TextSpacing | Spacing [get] |
| Represents the text spacing parameters used to draw the text. More...
|
|
Represents a run of text that should be drawn with the same style.
Definition at line 51 of file FormattedText.cs.
◆ FormattedText()
VectSharp.FormattedText.FormattedText |
( |
string |
text, |
|
|
Font |
font, |
|
|
Script |
script = Script.Normal , |
|
|
Brush |
brush = null , |
|
|
TextSpacing? |
spacing = null |
|
) |
| |
Creates a new FormattedText instance with the specified text , font , script position and brush .
- Parameters
-
text | The text that will be contained in the new FormattedText. |
font | The font that will be used by the new FormattedText. |
script | The script position of the new FormattedText. |
brush | The brush that will be used by the new FormattedText. |
spacing | The text spacing parameters used to draw the text. |
Definition at line 86 of file FormattedText.cs.
◆ Format() [1/2]
Parse the formatting information contained in a text string into a collection of FormattedText objects.
- Parameters
-
text | The string containing formatting information. Format information is specified using HTML-like tags:
-
<b></b> or <strong></strong> are used for bold text;
-
<i></i> or <em></em> are used for text in italics;
-
<u></u> are used for underlined text;
-
<sup></sup> and <sub></sub> are used, respectively, for superscript and subscript text;
-
<#COLOUR></#> is used to specify the colour of the text, where COLOUR is a CSS colour string (e.g. <#red> , <#0080FF> , or <#rgba(128, 80, 52, 0.5)> ).
|
normalFont | The font that will be used for text that is neither bold nor italic. |
boldFont | The font that will be used for text that is bold. Note that this does not necessarily have to be a bold font; this is just the font that is applied to text contained within <b></b> tags. |
italicFont | The font that will be used for text that is in italics. Note that this does not necessarily have to be an italic font; this is just the font that is applied to text contained within <i></i> tags. |
boldItalicFont | The font that will be used for text that is both in bold and in italics. |
defaultBrush | The default Brush that will be used for text runs that do not specify a colour. If this is null , the default Brush will be the one specified in the painting call. |
spacing | The text spacing parameters used to draw the text. |
- Returns
- A lazy collection of FormattedText objects. Note that every enumeration of this collection causes the text to be parsed again; if you need to enumerate this collection more than once, you should probably convert it e.g. to a List<T>.
Definition at line 114 of file FormattedText.cs.
◆ Format() [2/2]
Parse the formatting information contained in a text string into a collection of FormattedText objects, using fonts from a standard font family.
- Parameters
-
text | The string containing formatting information. Format information is specified using HTML-like tags:
-
<b></b> or <strong></strong> are used for bold text;
-
<i></i> or <em></em> are used for text in italics;
-
<u></u> are used for underlined text;
-
<sup></sup> and <sub></sub> are used, respectively, for superscript and subscript text;
-
<#COLOUR></#> is used to specify the colour of the text, where COLOUR is a CSS colour string (e.g. <#red> , <#0080FF> , or <#rgba(128, 80, 52, 0.5)> ).
|
fontFamily | The font family from which the fonts will be created. If this is a regular font family, the bold, italic and bold-italic versions of the font will be used for the formatted text. Otherwise, the relevant font styles will be toggled (e.g. if the supplied font family is bold, then regular text in the formatted string will be displayed as bold, while bold text in the formatted string will be displayed as regular text). |
fontSize | The size of the fonts to use. |
defaultUnderline | Determines whether text should be underlined by default. This is toggled by <u></u> tags. |
defaultBrush | The default Brush that will be used for text runs that do not specify a colour. If this is null , the default Brush will be the one specified in the painting call. |
spacing | The text spacing parameters used to draw the text. |
- Returns
- A lazy collection of FormattedText objects. Note that every enumeration of this collection causes the text to be parsed again; if you need to enumerate this collection more than once, you should probably convert it e.g. to a List<T>.
Definition at line 297 of file FormattedText.cs.
◆ Brush
Brush VectSharp.FormattedText.Brush |
|
get |
Represents the brush that should be used to draw the text. If this is null, the default brush is used.
Definition at line 71 of file FormattedText.cs.
◆ Font
Font VectSharp.FormattedText.Font |
|
get |
Represents the font that should be used to draw the text.
Definition at line 61 of file FormattedText.cs.
◆ Script
Script VectSharp.FormattedText.Script |
|
get |
◆ Spacing
Represents the text spacing parameters used to draw the text.
Definition at line 76 of file FormattedText.cs.
◆ Text
string VectSharp.FormattedText.Text |
|
get |
Represents the text represented by this instance.
Definition at line 56 of file FormattedText.cs.
The documentation for this class was generated from the following file: