PeachDrawing.Text

PeachDrawing.Text

TypefaceQuery Struct

What a caller wants from a family: the inputs to CSS Fonts 4 face matching.

public readonly record struct TypefaceQuery : System.IEquatable<PeachDrawing.Text.TypefaceQuery>

Implements System.IEquatable<TypefaceQuery>

Remarks

Matching narrows the faces of a family by width first, then by slant (upright, italic or oblique), then by weight, and takes the nearest face when there is no exact one, so a request for a condensed italic face gets the condensed face of a family whose condensed face is upright and whose italic face is of normal width. The size of the text is not part of a query: a Typeface has no size.

Constructors  
TypefaceQuery() Creates the query for regular, upright, normal-width text with no character to cover.
TypefaceQuery(double, int, bool, Nullable<Rune>, IReadOnlyList<AxisSetting>, Nullable<double>, Nullable<double>) What a caller wants from a family: the inputs to CSS Fonts 4 face matching.
Fields  
BoldWeight The weight of bold text, 700.
NormalWeight The weight of regular text, 400.
NormalWidth The normal width class, 5.
Properties  
Axes Values for the axes of a variable face (CSS font-variation-settings), or null for none. A face that is variable is matched at the location the weight, width and slant of the query give (its wght, wdth and ital axes), and these settings are applied after that, so they win. A face that is not variable ignores them.
IsItalic Whether an italic face is wanted.
MustCover A character the face has to be able to draw, or null for none. A face is taken to cover the characters of its unicode-range if it has one, and otherwise the ones its cmap maps.
ObliqueAngle The angle of the slant wanted, in degrees leaning to the right (CSS font-style: oblique 10deg), or null for the default angle of 14 degrees. It only matters when IsItalic is set: it chooses among faces that declare an oblique range (the one that holds the angle, or else the nearest), which are preferred to faces declared italic when an angle is given and the other way round when it is not, and a variable face’s slnt axis is set to it, kept inside the range the face declares.
Weight The weight wanted, from 1 to 1000 and not necessarily a whole number; 400 is normal and 700 is bold.
Width The width wanted, as an OpenType width class from 1 (ultra-condensed) to 9 (ultra-expanded) with 5 being normal.
WidthPercent The width wanted as a percentage of the normal width (CSS font-stretch: 87.5%), or null to use the width class in Width. It is what a variable face’s wdth axis is set to, and what faces that declare a range of widths are matched against.
Methods  
From(double, double, bool, Nullable<Rune>, IReadOnlyList<AxisSetting>, Nullable<double>) Builds a query from the primitive values a font-creation API typically starts with (a numeric weight, a width percentage, an italic flag, an optional character to cover, an already-resolved set of variable-font axes, and the sine of a requested oblique angle rather than the angle itself) - the one piece of query-building glue every backend that creates fonts from these needs, factored out so it is written once rather than once per backend.