// Copyright (c) Six Labors.
// Licensed under the Six Labors Split License.
using SixLabors.Fonts;
using System.Collections.Generic;
namespace SixLabors.ImageSharp.Drawing.Processing {
///
/// Provides configuration options for rendering and shaping of rich text.
///
public class RichTextOptions : TextOptions
{
///
/// Initializes a new instance of the class.
///
/// The font.
public RichTextOptions(Font font)
: base(font)
=> this.TextRuns = [];
///
/// Initializes a new instance of the class from properties
/// copied from the given instance.
///
/// The options whose properties are copied into this instance.
public RichTextOptions(RichTextOptions options)
: base(options)
{
List runs = new(options.TextRuns.Count);
foreach (RichTextRun run in options.TextRuns)
{
runs.Add(new RichTextRun()
{
Brush = run.Brush,
Pen = run.Pen,
StrikeoutPen = run.StrikeoutPen,
UnderlinePen = run.UnderlinePen,
OverlinePen = run.OverlinePen,
Start = run.Start,
End = run.End,
Font = run.Font,
TextAttributes = run.TextAttributes,
TextDecorations = run.TextDecorations,
Placeholder = run.Placeholder
});
}
this.TextRuns = runs;
}
///
/// Gets or sets an optional collection of text runs to apply to the body of text.
///
public new IReadOnlyList TextRuns
{
get => (IReadOnlyList)base.TextRuns;
set => base.TextRuns = value;
}
}
}