PdfFontQuery class
Namespace: PdfNetStack.Fonts
Assembly: PdfNetStack.dll
Package: PdfNetStack
What Find looks for in a family: weight, width and style, matched as CSS does, and for variable fonts the optical size and any other axis values to apply to the instance found.
public sealed class PdfFontQueryInheritance
Examples
Section titled “Examples”PdfOpenTypeFont? caption = fonts.Find("Roboto Flex", new PdfFontQuery
{
Weight = 650,
Width = 87.5,
Style = PdfFontStyle.Italic,
OpticalSize = 9,
});
Properties
Section titled “Properties”ObliqueAngle
Section titled “ ObliqueAngle”The slant in degrees for Oblique, -90 to 90, positive leaning right as in CSS. Default 14, the CSS default for oblique.
public double ObliqueAngle { get; init; }Property Value
Section titled “Property Value”Exceptions
Section titled “Exceptions”The value is not a number from -90 to 90.
OpticalSize
Section titled “ OpticalSize”The size the text is set at, for a variable font’s optical size axis (opsz), in the axis’s units. Null leaves the axis at its default; fonts without the axis ignore it.
public double? OpticalSize { get; init; }Property Value
Section titled “Property Value”Exceptions
Section titled “Exceptions”The value is zero, negative, infinite or not a number.
Upright, italic or oblique. Default upright.
public PdfFontStyle Style { get; init; }Property Value
Section titled “Property Value”Variations
Section titled “ Variations”Axis values by tag, applied last over the values the match chose, as CSS
font-variation-settings: { [“wght”] = 625, [“GRAD”] = 50 }. Tags the font does
not have are ignored and values are clamped to each axis’s range. The values are copied
when set, so changing the dictionary afterwards does not change the query.
public IReadOnlyDictionary<string, double>? Variations { get; init; }Property Value
Section titled “Property Value”IReadOnlyDictionary<string, double>?
Exceptions
Section titled “Exceptions”A value is infinite or not a number.
Weight
Section titled “ Weight”CSS weight, 1 to 1000: 400 regular, 700 bold. Default 400.
public double Weight { get; init; }Property Value
Section titled “Property Value”Exceptions
Section titled “Exceptions”The value is not a number from 1 to 1000.
Width as a percentage of normal, as CSS font-width: 75 condensed, 125 expanded. Default 100.
public double Width { get; init; }Property Value
Section titled “Property Value”Exceptions
Section titled “Exceptions”The value is negative, infinite or not a number.