Edit

SKFontArguments Struct

Definition

Specifies arguments for customizing a typeface clone, including the collection index, color palette, palette overrides, and variation design position.

public ref struct SKFontArguments
Inheritance
SKFontArguments

Examples

Cloning a variable font at a specific weight:

using var typeface = SKTypeface.FromFile("variable-font.ttf");

var wghtTag = SKFourByteTag.Parse("wght");
var args = new SKFontArguments
{
    VariationDesignPosition = new[]
    {
        new SKFontVariationPositionCoordinate { Axis = wghtTag, Value = 700 },
    },
};
using var bold = typeface.Clone(args);

Remarks

`SKFontArguments` is a `ref struct` that groups the parameters passed to <xref:SkiaSharp.SKTypeface.Clone*> when creating a customized typeface instance. Because it is a `ref struct`, it cannot be stored on the heap or used across async boundaries.

Typically you create an instance, set its properties, and pass it directly to `Clone`.

Properties

Name Description
CollectionIndex

Gets or sets the index of the desired typeface within a font collection.

PaletteIndex

Gets or sets the color palette index to use when cloning the typeface.

PaletteOverrides

Gets or sets the per-entry color overrides to apply to the palette.

VariationDesignPosition

Gets or sets the variation design position to apply to the cloned typeface.

Applies to