Class VariationAxis
One axis of a variable font, from its fvar table.
public sealed record VariationAxis : IEquatable<VariationAxis>
- Inheritance
-
VariationAxis
- 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
VariationAxis(FontTag, string, float, float, float, bool)
One axis of a variable font, from its fvar table.
public VariationAxis(FontTag Tag, string Name, float Min, float Default, float Max, bool IsHidden)
Parameters
TagFontTagThe axis tag, such as
wght.NamestringThe axis's English name from the name table, such as "Weight", or the tag when the font names none.
MinfloatThe smallest value.
DefaultfloatThe default value, where the font's own outlines are.
MaxfloatThe largest value.
IsHiddenboolWhether the font asks applications not to show the axis (fvar's HIDDEN_AXIS flag).
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
Default
The default value, where the font's own outlines are.
public float Default { get; init; }
Property Value
IsHidden
Whether the font asks applications not to show the axis (fvar's HIDDEN_AXIS flag).
public bool IsHidden { get; init; }
Property Value
Max
The largest value.
public float Max { get; init; }
Property Value
Min
The smallest value.
public float Min { get; init; }
Property Value
Name
The axis's English name from the name table, such as "Weight", or the tag when the font names none.
public string Name { get; init; }
Property Value
Tag
The axis tag, such as wght.
public FontTag Tag { get; init; }