Class NamedInstance
A named instance of a variable font, such as "Bold Condensed", from its fvar table.
public sealed record NamedInstance : IEquatable<NamedInstance>
- Inheritance
-
NamedInstance
- Implements
- Inherited Members
Examples
// A variable font's axes and named instances, and the face at any position on them.
Typeface flex = Typeface.FromFile(VariableFile);
foreach (VariationAxis axis in flex.VariationAxes)
{
Console.WriteLine($"{axis.Tag} {axis.Name}: {axis.Min} to {axis.Max}, default {axis.Default}");
}
Typeface semiBold = flex.WithVariations(FontVariation.Weight(600), FontVariation.Width(90));
Typeface black = flex.WithNamedInstance(flex.NamedInstances.Count - 1);
// The optical size follows the font size unless the face sets it (OpticalSizing.None turns that off).
var caption = new Font(semiBold, 11);
Typeface drawn = caption.EffectiveTypeface;
// For a PDF, the subset is a static font at the face's position, which every viewer draws as it is.
FontSubset subset = FontSubsetter.Subset(semiBold, caption.Shape("Static at 600").Glyphs.ToArray());
Constructors
NamedInstance(string, string?, IReadOnlyList<FontVariation>)
A named instance of a variable font, such as "Bold Condensed", from its fvar table.
public NamedInstance(string Name, string? PostScriptName, IReadOnlyList<FontVariation> Coordinates)
Parameters
NamestringThe instance's English subfamily name, such as "Bold".
PostScriptNamestringThe instance's PostScript name, or null when the font gives none.
CoordinatesIReadOnlyList<FontVariation>The position on every axis, in fvar order.
Examples
// A variable font's axes and named instances, and the face at any position on them.
Typeface flex = Typeface.FromFile(VariableFile);
foreach (VariationAxis axis in flex.VariationAxes)
{
Console.WriteLine($"{axis.Tag} {axis.Name}: {axis.Min} to {axis.Max}, default {axis.Default}");
}
Typeface semiBold = flex.WithVariations(FontVariation.Weight(600), FontVariation.Width(90));
Typeface black = flex.WithNamedInstance(flex.NamedInstances.Count - 1);
// The optical size follows the font size unless the face sets it (OpticalSizing.None turns that off).
var caption = new Font(semiBold, 11);
Typeface drawn = caption.EffectiveTypeface;
// For a PDF, the subset is a static font at the face's position, which every viewer draws as it is.
FontSubset subset = FontSubsetter.Subset(semiBold, caption.Shape("Static at 600").Glyphs.ToArray());
Properties
Coordinates
The position on every axis, in fvar order.
public IReadOnlyList<FontVariation> Coordinates { get; init; }
Property Value
Name
The instance's English subfamily name, such as "Bold".
public string Name { get; init; }
Property Value
PostScriptName
The instance's PostScript name, or null when the font gives none.
public string? PostScriptName { get; init; }