| HyperTextProcessor Class |
Namespace: Candlelight.UI
[SerializableAttribute] public class HyperTextProcessor : IDisposable, ITextSource
The HyperTextProcessor type exposes the following members.
| Name | Description | |
|---|---|---|
| CloseTagCaptureGroup |
Gets the name of the capture group used for a close tag in a piece of text.
| |
| GUIStyle |
Gets a GUIStyle for the current property values.
| |
| InputText |
Gets or sets the input text.
| |
| InputTextSource |
Gets or sets the input text source. If a value is assigned, its OutputText will be used in place of the
value in the InputText property of this HyperTextProcessor.
| |
| IsDynamicFontDesired |
Gets or sets a value indicating whether dynamic font output is desired on this instance.
| |
| IsDynamicFontEnabled |
Gets a value indicating whether dynamic font output is enabled.
| |
| IsRichTextDesired |
Gets or sets a value indicating whether rich text is desired on this instance.
| |
| IsRichTextEnabled |
Gets a value indicating whether rich text is enabled on this instance.
| |
| OpenTagCaptureGroup |
Gets the name of the capture group used for an open tag in a piece of text.
| |
| OutputText |
Gets the output text.
| |
| ReferenceFontSize |
Gets or sets the reference font size. It should correspond to the font size where OutputText will be sent.
| |
| ReservedTags |
Gets the reserved tags.
| |
| ScaleFactor |
Gets or sets the scale factor.
| |
| ShouldOverrideStylesFontSize |
Gets or sets a value indicating whether this HyperTextProcessor should override the font size
specified in styles, if one is assigned.
| |
| Styles |
Gets or sets the styles.
| |
| TextCaptureGroup |
Gets the name of the capture group used for text enclosed in a tag.
|
| Name | Description | |
|---|---|---|
| BecameDirty |
Occurs whenever a value on this instance has changed.
|
This class's primary function is to extract <a> tags and their relevant information from the value supplied to the InputText property, and format the resulting string for the OutputText property. You can then use the GetLinks(ListHyperTextProcessorLink) method to get information about the links that were found, such as their character indices in OutputText. The minimal syntactical requirement for an <a> tag is the name attribute. For example, the input text "Here is a <a name="some_link">link</a>" will result in the output text "Here is a link".
Assigning a HyperTextStyles object to the Styles property also allows for some additional processing. If IsRichTextDesired is , then it will automatically convert any custom tags and quads found in InputText, as well as insert <color> tags as needed. If IsDynamicFontDesired is , then <size> tags will automatically be inserted for links, custom tags, and quads. The value of <size> tags depends on either the font size specified in the styles or the ReferenceFontSize property if no styles are assigned, as well as the ScaleFactor property. Information about custom tags and quads can then be extracted via GetCustomTags(ListHyperTextProcessorCustomTag) and GetQuads(ListHyperTextProcessorQuad). The syntactical requirements for custom styles are:
Link Classes: <a name="some_link" class="class_name">link</a>
Tags: <custom>text</custom>
Quads: <quad class="class_name" />
You can also assign KeywordCollection objects to automatically detect and tag keywords appearing in InputText as either links, custom tags, or quads. Any links automatically detected in this way will have a name attribute equal to the keyword. For example, the word "dog" would become "<a name="dog">dog</a>". Keywords may contain non-alphanumeric characters (i.e. [^A-Za-z0-9]). For example, "dog", "dog's", and ":)" may all be keywords.
Keywords will only be detected when occurring in text if they are not immediately preceded or followed by alphanumeric characters, except for keywords that begin or end with non-alphanumeric characters, respectively. For example, the keyword "dog" would be matched in any of the following strings:
However, the keyword "dog" would not be matched in the following strings:
On the other hand, the keyword ":)" would be matched in all of the following instances:
The class also allows specification of sizes as percentages rather than raw values. For example, you can use the pattern: "<size=120%>BIG TEXT</size>".