Class SkiaLabel.SpanMeasurement
Span-based measurement methods to avoid string allocations
public static class SkiaLabel.SpanMeasurement
- Inheritance
-
SkiaLabel.SpanMeasurement
- Inherited Members
Methods
AppendChar(StringBuilder, char)
Appends a single character to StringBuilder
public static void AppendChar(StringBuilder sb, char c)
Parameters
sbStringBuildercchar
AppendSpan(StringBuilder, ReadOnlySpan<char>)
Appends a ReadOnlySpan to StringBuilder without intermediate string allocation
public static void AppendSpan(StringBuilder sb, ReadOnlySpan<char> span)
Parameters
sbStringBuilderspanReadOnlySpan<char>
IsGlyphAlwaysAvailableSpan(ReadOnlySpan<char>)
Checks if glyph is always available without string conversion
public static bool IsGlyphAlwaysAvailableSpan(ReadOnlySpan<char> glyphSpan)
Parameters
glyphSpanReadOnlySpan<char>
Returns
IsSpaceSpan(ReadOnlySpan<char>, char)
Checks if a span represents a single space character
public static bool IsSpaceSpan(ReadOnlySpan<char> span, char spaceChar)
Parameters
spanReadOnlySpan<char>spaceCharchar
Returns
LastNonSpaceIndexSpan(ReadOnlySpan<char>)
Finds the last non-space character index in a span
public static int LastNonSpaceIndexSpan(ReadOnlySpan<char> textSpan)
Parameters
textSpanReadOnlySpan<char>
Returns
MeasurePartialTextWidthSpan(SKPaint, ReadOnlySpan<char>, bool, float, SKTypeface)
Measures partial text width using span-based operations where possible Falls back to string conversion only for cache compatibility
public static float MeasurePartialTextWidthSpan(SKPaint paint, ReadOnlySpan<char> textSpan, bool needsShaping, float scale, SKTypeface paintTypeface)
Parameters
paintSKPainttextSpanReadOnlySpan<char>needsShapingboolscalefloatpaintTypefaceSKTypeface
Returns
MeasureTextWidthWithAdvanceSpan(SKPaint, ReadOnlySpan<char>)
Measures text width using ReadOnlySpan without converting to string
public static float MeasureTextWidthWithAdvanceSpan(SKPaint paint, ReadOnlySpan<char> textSpan)
Parameters
paintSKPainttextSpanReadOnlySpan<char>
Returns
SpanToStringForCache(ReadOnlySpan<char>)
Converts ReadOnlySpan to string only when absolutely necessary for cache keys This is the only place where we allow span-to-string conversion for caching
public static string SpanToStringForCache(ReadOnlySpan<char> span)
Parameters
spanReadOnlySpan<char>