Class ShapedLine
One line of ShapedText: its range and its runs in visual order.
public sealed class ShapedLine
- Inheritance
-
ShapedLine
- Inherited Members
Examples
// Whole text: lines at hard breaks, bidi levels, script runs, fallback fonts, runs in display order.
var font = new Font(face, 24);
var options = new ShapingOptions { Fallback = new FontFallback(fonts.Families) };
ShapedText shaped = TextShaper.Shape("Shalom: \u05E9\u05DC\u05D5\u05DD!", font, options);
float x = 0;
foreach (ShapedRun run in shaped.Lines[0].Runs)
{
GlyphRun glyphs = run.ToGlyphRun(new System.Numerics.Vector2(x, 0), shaped.Text); // what a canvas draws
x += run.Advance;
}
Properties
Advance
Gets the line's advance: the runs' advances summed.
public float Advance { get; }
Property Value
Ascent
Gets the highest ascent of the line's fonts, y up.
public float Ascent { get; }
Property Value
Descent
Gets the lowest descent of the line's fonts, y up (negative below the baseline).
public float Descent { get; }
Property Value
Length
Gets the number of UTF-16 units in the line, its break excluded.
public int Length { get; }
Property Value
LineHeight
Gets the largest line height of the line's fonts.
public float LineHeight { get; }
Property Value
ParagraphLevel
Gets the line's paragraph level: 0 for left to right, 1 for right to left.
public int ParagraphLevel { get; }
Property Value
Runs
Gets the runs from left to right (top to bottom for a vertical line).
public IReadOnlyList<ShapedRun> Runs { get; }
Property Value
Start
Gets the index of the line's first UTF-16 unit, its break excluded.
public int Start { get; }