Class SvgTextUtil
Class containing utility methods for text operations in the context of SVG processing
public sealed class SvgTextUtil
- Inheritance
-
SvgTextUtil
- Inherited Members
Methods
FilterReferenceValue(string)
The reference value may contain a hashtag character or 'url' designation and this method will filter them.
public static string FilterReferenceValue(string name)
Parameters
name
stringvalue to be filtered
Returns
- string
filtered value
IsOnlyWhiteSpace(string)
Check if the String is only composed of whitespace characters
public static bool IsOnlyWhiteSpace(string s)
Parameters
s
stringstring to check
Returns
- bool
true if the string only contains whitespace characters, false otherwise
ProcessWhiteSpace(TextSvgBranchRenderer, bool)
Process the whitespace inside the Text Tree.
public static void ProcessWhiteSpace(TextSvgBranchRenderer root, bool isLeadingElement)
Parameters
root
TextSvgBranchRendererroot of the text-renderer subtree
isLeadingElement
booltrue if this element is a leading element(either the first child or the first element after an absolute position change)
Remarks
Process the whitespace inside the Text Tree. Whitespace is collapsed and new lines are handled A leading element in each subtree is handled different: the preceding whitespace is trimmed instead of kept
ResolveFontSize(ISvgTextNodeRenderer, float)
Resolve the font size stored inside the passed renderer
public static float ResolveFontSize(ISvgTextNodeRenderer renderer, float parentFontSize)
Parameters
renderer
ISvgTextNodeRendererrenderer containing the font size declaration
parentFontSize
floatparent font size to fall back on if the renderer does not contain a font size declarations or if the stored declaration is invalid
Returns
- float
float containing the font-size, or the parent font size if the renderer's declaration cannot be resolved
TrimLeadingWhitespace(string)
Trim all the leading whitespace characters from the passed string
public static string TrimLeadingWhitespace(string toTrim)
Parameters
toTrim
stringstring to trim
Returns
- string
string with all leading whitespace characters removed
TrimTrailingWhitespace(string)
Trim all the trailing whitespace characters from the passed string
public static string TrimTrailingWhitespace(string toTrim)
Parameters
toTrim
stringstring to trim
Returns
- string
string with al trailing whitespace characters removed