Class GlyphRun
Represents a sequence of glyphs from a single face of a single font at a single size, and with a single rendering style.
public sealed class GlyphRun : IDisposable
- Inheritance
-
GlyphRun
- Implements
- Inherited Members
Constructors
GlyphRun(IGlyphTypeface, double, ReadOnlyMemory<char>, IReadOnlyList<GlyphInfo>, Point?, int)
Initializes a new instance of the GlyphRun class by specifying properties of the class.
public GlyphRun(IGlyphTypeface glyphTypeface, double fontRenderingEmSize, ReadOnlyMemory<char> characters, IReadOnlyList<GlyphInfo> glyphInfos, Point? baselineOrigin = null, int biDiLevel = 0)
Parameters
glyphTypeface
IGlyphTypefaceThe glyph typeface.
fontRenderingEmSize
doubleThe rendering em size.
characters
ReadOnlyMemory<char>The characters.
glyphInfos
IReadOnlyList<GlyphInfo>The list of glyphs used.
baselineOrigin
Point?The baseline origin of the run.
biDiLevel
intThe bidi level.
GlyphRun(IGlyphTypeface, double, ReadOnlyMemory<char>, IReadOnlyList<ushort>, Point?, int)
Initializes a new instance of the GlyphRun class by specifying properties of the class.
public GlyphRun(IGlyphTypeface glyphTypeface, double fontRenderingEmSize, ReadOnlyMemory<char> characters, IReadOnlyList<ushort> glyphIndices, Point? baselineOrigin = null, int biDiLevel = 0)
Parameters
glyphTypeface
IGlyphTypefaceThe glyph typeface.
fontRenderingEmSize
doubleThe rendering em size.
characters
ReadOnlyMemory<char>The characters.
glyphIndices
IReadOnlyList<ushort>The glyph indices.
baselineOrigin
Point?The baseline origin of the run.
biDiLevel
intThe bidi level.
Properties
BaselineOrigin
Gets or sets the baseline origin of theGlyphRun.
public Point BaselineOrigin { get; set; }
Property Value
BiDiLevel
Gets or sets the bidirectional nesting level of the GlyphRun.
public int BiDiLevel { get; set; }
Property Value
Bounds
Gets the conservative bounding box of the GlyphRun.
public Rect Bounds { get; }
Property Value
Characters
Gets or sets the list of UTF16 code points that represent the Unicode content of the GlyphRun.
public ReadOnlyMemory<char> Characters { get; set; }
Property Value
FontRenderingEmSize
Gets or sets the em size used for rendering the GlyphRun.
public double FontRenderingEmSize { get; set; }
Property Value
GlyphInfos
Gets or sets the list of glyphs to use to render this run.
public IReadOnlyList<GlyphInfo> GlyphInfos { get; set; }
Property Value
GlyphTypeface
Gets the IGlyphTypeface for the GlyphRun.
public IGlyphTypeface GlyphTypeface { get; }
Property Value
InkBounds
public Rect InkBounds { get; }
Property Value
IsLeftToRight
Returns true
if the text direction is left-to-right. Otherwise, returns false
.
public bool IsLeftToRight { get; }
Property Value
Metrics
public GlyphRunMetrics Metrics { get; }
Property Value
Methods
BuildGeometry()
Obtains geometry for the glyph run.
public Geometry BuildGeometry()
Returns
- Geometry
The geometry returned contains the combined geometry of all glyphs in the glyph run.
Dispose()
public void Dispose()
FindGlyphIndex(int)
Finds a glyph index for given character index.
public int FindGlyphIndex(int characterIndex)
Parameters
characterIndex
intThe character index.
Returns
- int
The glyph index.
FindNearestCharacterHit(int, out double)
Finds the nearest CharacterHit at given index.
public CharacterHit FindNearestCharacterHit(int index, out double width)
Parameters
Returns
- CharacterHit
The nearest CharacterHit.
GetCharacterHitFromDistance(double, out bool)
Retrieves the CharacterHit value that represents the character hit of the caret of the GlyphRun.
public CharacterHit GetCharacterHitFromDistance(double distance, out bool isInside)
Parameters
distance
doubleOffset to use for computing the caret character hit.
isInside
boolDetermines whether the character hit is inside the GlyphRun.
Returns
- CharacterHit
A CharacterHit value that represents the character hit that is closest to the distance value. The out parameter
isInside
returnstrue
if the character hit is inside the GlyphRun; otherwise,false
.
GetDistanceFromCharacterHit(CharacterHit)
Retrieves the offset from the leading edge of the GlyphRun to the leading or trailing edge of a caret stop containing the specified character hit.
public double GetDistanceFromCharacterHit(CharacterHit characterHit)
Parameters
characterHit
CharacterHitThe CharacterHit to use for computing the offset.
Returns
- double
A double that represents the offset from the leading edge of the GlyphRun to the leading or trailing edge of a caret stop containing the character hit.
GetIntersections(float, float)
Gets the intersections of specified upper and lower limit.
public IReadOnlyList<float> GetIntersections(float lowerLimit, float upperLimit)
Parameters
Returns
GetNextCaretCharacterHit(CharacterHit)
Retrieves the next valid caret character hit in the logical direction in the GlyphRun.
public CharacterHit GetNextCaretCharacterHit(CharacterHit characterHit)
Parameters
characterHit
CharacterHitThe CharacterHit to use for computing the next hit value.
Returns
- CharacterHit
A CharacterHit that represents the next valid caret character hit in the logical direction. If the return value is equal to
characterHit
, no further navigation is possible in the GlyphRun.
GetPreviousCaretCharacterHit(CharacterHit)
Retrieves the previous valid caret character hit in the logical direction in the GlyphRun.
public CharacterHit GetPreviousCaretCharacterHit(CharacterHit characterHit)
Parameters
characterHit
CharacterHitThe CharacterHit to use for computing the previous hit value.
Returns
- CharacterHit
A cref="CharacterHit"/> that represents the previous valid caret character hit in the logical direction. If the return value is equal to
characterHit
, no further navigation is possible in the GlyphRun.
TryCreateImmutableGlyphRunReference()
public IImmutableGlyphRunReference? TryCreateImmutableGlyphRunReference()