PeachDrawing.Text

PeachDrawing.Text.TypefaceFamily

TypefaceFamily.TryMatch(TypefaceQuery, TypefaceMatch) Method

Finds the face of this family that matches a query best (CSS Fonts 4 section 5).

public bool TryMatch(in PeachDrawing.Text.TypefaceQuery query, out PeachDrawing.Text.TypefaceMatch match);

Parameters

query TypefaceQuery

What is wanted.

match TypefaceMatch

The best face, and what has to be faked because it falls short of the query.

Returns

System.Boolean
false when the query asks for a character that no face of the family covers.

Exceptions

System.ArgumentException
The weight, width percentage or oblique angle of the query is not a finite number.

System.InvalidOperationException
The face that matched is not a font this library can parse. A font is read in full when it is first matched and not when it is added, so a set does not pay for the fonts a caller never uses.

Remarks

Of the faces that qualify, the query’s width is matched first, then its slant, then its weight, taking the nearest when none is exact; where faces tie, the one added last wins. When the query names a character to cover, only faces that cover it qualify.