# PdfFontQuery class

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

Namespace: [PdfNetStack.Fonts](https://www.jadev-corp.com/api/pdfnetstack-fonts/)  
Assembly: PdfNetStack.dll  
Package: `PdfNetStack`

What [Find](https://www.jadev-corp.com/api/pdfnetstack-fonts/pdffontcollection/#PdfNetStack_Fonts_PdfFontCollection_Find_System_String_PdfNetStack_Fonts_PdfFontQuery_) 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.

```csharp
public sealed class PdfFontQuery
```

**Inheritance**

[object](https://learn.microsoft.com/dotnet/api/system.object) ← 
[PdfFontQuery](https://www.jadev-corp.com/api/pdfnetstack-fonts/pdffontquery/)

## Examples

<pre><code class="lang-csharp">PdfOpenTypeFont? caption = fonts.Find("Roboto Flex", new PdfFontQuery
{
    Weight = 650,
    Width = 87.5,
    Style = PdfFontStyle.Italic,
    OpticalSize = 9,
});</code></pre>

## Properties

### <a id="PdfNetStack_Fonts_PdfFontQuery_ObliqueAngle"></a> ObliqueAngle

The slant in degrees for [Oblique](https://www.jadev-corp.com/api/pdfnetstack-fonts/pdffontstyle/), -90 to 90, positive leaning
right as in CSS. Default 14, the CSS default for oblique.

```csharp
public double ObliqueAngle { get; init; }
```

#### Property Value

 [double](https://learn.microsoft.com/dotnet/api/system.double)

#### Exceptions

 [ArgumentOutOfRangeException](https://learn.microsoft.com/dotnet/api/system.argumentoutofrangeexception)

The value is not a number from -90 to 90.

### <a id="PdfNetStack_Fonts_PdfFontQuery_OpticalSize"></a> 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.

```csharp
public double? OpticalSize { get; init; }
```

#### Property Value

 [double](https://learn.microsoft.com/dotnet/api/system.double)?

#### Exceptions

 [ArgumentOutOfRangeException](https://learn.microsoft.com/dotnet/api/system.argumentoutofrangeexception)

The value is zero, negative, infinite or not a number.

### <a id="PdfNetStack_Fonts_PdfFontQuery_Style"></a> Style

Upright, italic or oblique. Default upright.

```csharp
public PdfFontStyle Style { get; init; }
```

#### Property Value

 [PdfFontStyle](https://www.jadev-corp.com/api/pdfnetstack-fonts/pdffontstyle/)

### <a id="PdfNetStack_Fonts_PdfFontQuery_Variations"></a> Variations

Axis values by tag, applied last over the values the match chose, as CSS
font-variation-settings: <code>{ ["wght"] = 625, ["GRAD"] = 50 }</code>. 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.

```csharp
public IReadOnlyDictionary<string, double>? Variations { get; init; }
```

#### Property Value

 [IReadOnlyDictionary](https://learn.microsoft.com/dotnet/api/system.collections.generic.ireadonlydictionary\-2)<[string](https://learn.microsoft.com/dotnet/api/system.string), [double](https://learn.microsoft.com/dotnet/api/system.double)\>?

#### Exceptions

 [ArgumentException](https://learn.microsoft.com/dotnet/api/system.argumentexception)

A value is infinite or not a number.

### <a id="PdfNetStack_Fonts_PdfFontQuery_Weight"></a> Weight

CSS weight, 1 to 1000: 400 regular, 700 bold. Default 400.

```csharp
public double Weight { get; init; }
```

#### Property Value

 [double](https://learn.microsoft.com/dotnet/api/system.double)

#### Exceptions

 [ArgumentOutOfRangeException](https://learn.microsoft.com/dotnet/api/system.argumentoutofrangeexception)

The value is not a number from 1 to 1000.

### <a id="PdfNetStack_Fonts_PdfFontQuery_Width"></a> Width

Width as a percentage of normal, as CSS font-width: 75 condensed, 125 expanded. Default 100.

```csharp
public double Width { get; init; }
```

#### Property Value

 [double](https://learn.microsoft.com/dotnet/api/system.double)

#### Exceptions

 [ArgumentOutOfRangeException](https://learn.microsoft.com/dotnet/api/system.argumentoutofrangeexception)

The value is negative, infinite or not a number.

Source: https://www.jadev-corp.com/pdfnetstack/api/pdfnetstack-fonts/pdffontquery/
