PeachDrawing.Text

PeachDrawing.Text.TypefaceQuery

TypefaceQuery Constructors

Overloads  
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.

TypefaceQuery() Constructor

Creates the query for regular, upright, normal-width text with no character to cover.

public TypefaceQuery();

Remarks

default(TypefaceQuery) is not the same thing: like any struct it is all zeros, which is a weight of zero and a width class of zero, so write new TypefaceQuery() for the normal query.

TypefaceQuery(double, int, bool, Nullable<Rune>, IReadOnlyList<AxisSetting>, Nullable<double>, Nullable<double>) Constructor

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

public TypefaceQuery(double Weight=400.0, int Width=5, bool IsItalic=false, System.Nullable<System.Text.Rune> MustCover=null, System.Collections.Generic.IReadOnlyList<PeachDrawing.Text.AxisSetting>? Axes=null, System.Nullable<double> WidthPercent=null, System.Nullable<double> ObliqueAngle=null);

Parameters

Weight System.Double

The weight wanted, from 1 to 1000 and not necessarily a whole number; 400 is normal and 700 is bold.

Width System.Int32

The width wanted, as an OpenType width class from 1 (ultra-condensed) to 9 (ultra-expanded) with 5 being normal.

IsItalic System.Boolean

Whether an italic face is wanted.

MustCover System.Nullable<System.Text.Rune>

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.

Axes System.Collections.Generic.IReadOnlyList<AxisSetting>

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.

WidthPercent System.Nullable<System.Double>

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.

ObliqueAngle System.Nullable<System.Double>

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.

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.