# FontSpec

Identifies a font without depending on a platform drawing framework.

 Class  

`ChartForgeX.Typography`

**Namespace**

`ChartForgeX.Typography`

**Assembly**

`ChartForgeX`

**Source**

[FontSpec.cs:11](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX/Typography/FontSpec.cs#L11)

**Modifiers**

sealed

**Attributes**

 `Fluent(Copy = "Clone")` 

Identifies a font without depending on a platform drawing framework.

## Inheritance

- object
- FontSpec

## Usage

 Explore 45 API references to this type 

This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.

### Returned or exposed by 24

- Property [VisualRenderContext.Font](/api/chartforgex-rendering-visualrendercontext/#property-font)
- Method [VisualTypography.ToFontSpec](/api/chartforgex-themes-visualtypography/#method-tofontspec-boolean)
- Extension method [FontSpec.CollectionIndex](/api/chartforgex-typography-fontspec/#extension-collectionindex-chartforgex-typography-fontspec-nullable-system-int32)
- Extension method [FontSpec.ColorPaletteIndex](/api/chartforgex-typography-fontspec/#extension-colorpaletteindex-chartforgex-typography-fontspec-int32)
- Extension method [FontSpec.FaceName](/api/chartforgex-typography-fontspec/#extension-facename-chartforgex-typography-fontspec-string)
- Extension method [FontSpec.Family](/api/chartforgex-typography-fontspec/#extension-family-chartforgex-typography-fontspec-string)
- Extension method [FontSpec.FilePath](/api/chartforgex-typography-fontspec/#extension-filepath-chartforgex-typography-fontspec-string)
- Extension method [FontSpec.Italic](/api/chartforgex-typography-fontspec/#extension-italic-chartforgex-typography-fontspec-boolean)
- Extension method [FontSpec.Variations](/api/chartforgex-typography-fontspec/#extension-variations-chartforgex-typography-fontspec-chartforgex-typography-fontvariationsettings)
- Extension method [FontSpec.Weight](/api/chartforgex-typography-fontspec/#extension-weight-chartforgex-typography-fontspec-int32)
- Method [FontSpec.Clone](/api/chartforgex-typography-fontspec/#method-clone)
- Method [FontSpec.FromFamily](/api/chartforgex-typography-fontspec/#method-fromfamily-string)
- Method [FontSpec.FromFile](/api/chartforgex-typography-fontspec/#method-fromfile-string-nullable-system-int32-string)
- Method [FontSpec.SystemSans](/api/chartforgex-typography-fontspec/#method-systemsans)
- Method [FontSpec.Variation](/api/chartforgex-typography-fontspec/#method-variation-string-double)
- Method [FontSpecFluent.CollectionIndex](/api/chartforgex-typography-fontspecfluent/#method-collectionindex-chartforgex-typography-fontspec-nullable-system-int32)
- Method [FontSpecFluent.ColorPaletteIndex](/api/chartforgex-typography-fontspecfluent/#method-colorpaletteindex-chartforgex-typography-fontspec-int32)
- Method [FontSpecFluent.FaceName](/api/chartforgex-typography-fontspecfluent/#method-facename-chartforgex-typography-fontspec-string)
- Method [FontSpecFluent.Family](/api/chartforgex-typography-fontspecfluent/#method-family-chartforgex-typography-fontspec-string)
- Method [FontSpecFluent.FilePath](/api/chartforgex-typography-fontspecfluent/#method-filepath-chartforgex-typography-fontspec-string)
- Method [FontSpecFluent.Italic](/api/chartforgex-typography-fontspecfluent/#method-italic-chartforgex-typography-fontspec-boolean)
- Method [FontSpecFluent.Variations](/api/chartforgex-typography-fontspecfluent/#method-variations-chartforgex-typography-fontspec-chartforgex-typography-fontvariationsettings)
- Method [FontSpecFluent.Weight](/api/chartforgex-typography-fontspecfluent/#method-weight-chartforgex-typography-fontspec-int32)
- Property [TextStyle.Font](/api/chartforgex-typography-textstyle/#property-font)

### Accepted by parameters 21

- Constructor [VisualRenderContext.VisualRenderContext](/api/chartforgex-rendering-visualrendercontext/#constructor-ctor-chartforgex-rendering-visuallayoutoptions-chartforgex-themes-visualtheme-chartforgex-thememode-chartforgex-rendering-visualframe-chartforgex-typography-fontspec) parameter `font`
- Extension method [FontSpec.CollectionIndex](/api/chartforgex-typography-fontspec/#extension-collectionindex-chartforgex-typography-fontspec-nullable-system-int32) parameter `fontSpec`
- Extension method [FontSpec.ColorPaletteIndex](/api/chartforgex-typography-fontspec/#extension-colorpaletteindex-chartforgex-typography-fontspec-int32) parameter `fontSpec`
- Extension method [FontSpec.FaceName](/api/chartforgex-typography-fontspec/#extension-facename-chartforgex-typography-fontspec-string) parameter `fontSpec`
- Extension method [FontSpec.Family](/api/chartforgex-typography-fontspec/#extension-family-chartforgex-typography-fontspec-string) parameter `fontSpec`
- Extension method [FontSpec.FilePath](/api/chartforgex-typography-fontspec/#extension-filepath-chartforgex-typography-fontspec-string) parameter `fontSpec`
- Extension method [FontSpec.Italic](/api/chartforgex-typography-fontspec/#extension-italic-chartforgex-typography-fontspec-boolean) parameter `fontSpec`
- Extension method [FontSpec.Variations](/api/chartforgex-typography-fontspec/#extension-variations-chartforgex-typography-fontspec-chartforgex-typography-fontvariationsettings) parameter `fontSpec`
- Extension method [FontSpec.Weight](/api/chartforgex-typography-fontspec/#extension-weight-chartforgex-typography-fontspec-int32) parameter `fontSpec`
- Method [FontSpecFluent.CollectionIndex](/api/chartforgex-typography-fontspecfluent/#method-collectionindex-chartforgex-typography-fontspec-nullable-system-int32) parameter `fontSpec`
- Method [FontSpecFluent.ColorPaletteIndex](/api/chartforgex-typography-fontspecfluent/#method-colorpaletteindex-chartforgex-typography-fontspec-int32) parameter `fontSpec`
- Method [FontSpecFluent.FaceName](/api/chartforgex-typography-fontspecfluent/#method-facename-chartforgex-typography-fontspec-string) parameter `fontSpec`
- Method [FontSpecFluent.Family](/api/chartforgex-typography-fontspecfluent/#method-family-chartforgex-typography-fontspec-string) parameter `fontSpec`
- Method [FontSpecFluent.FilePath](/api/chartforgex-typography-fontspecfluent/#method-filepath-chartforgex-typography-fontspec-string) parameter `fontSpec`
- Method [FontSpecFluent.Italic](/api/chartforgex-typography-fontspecfluent/#method-italic-chartforgex-typography-fontspec-boolean) parameter `fontSpec`
- Method [FontSpecFluent.Variations](/api/chartforgex-typography-fontspecfluent/#method-variations-chartforgex-typography-fontspec-chartforgex-typography-fontvariationsettings) parameter `fontSpec`
- Method [FontSpecFluent.Weight](/api/chartforgex-typography-fontspecfluent/#method-weight-chartforgex-typography-fontspec-int32) parameter `fontSpec`
- Extension method [TextStyle.Font](/api/chartforgex-typography-textstyle/#extension-font-chartforgex-typography-textstyle-action-chartforgex-typography-fontspec) parameter `configure`
- Extension method [TextStyle.Font](/api/chartforgex-typography-textstyle/#extension-font-chartforgex-typography-textstyle-chartforgex-typography-fontspec) parameter `value`
- Method [TextStyleFluent.Font](/api/chartforgex-typography-textstylefluent/#method-font-chartforgex-typography-textstyle-action-chartforgex-typography-fontspec) parameter `configure`
- Method [TextStyleFluent.Font](/api/chartforgex-typography-textstylefluent/#method-font-chartforgex-typography-textstyle-chartforgex-typography-fontspec) parameter `value`

 Filter members   

    Show inherited   

 

## Constructors

 `public FontSpec()` [#](#constructor-ctor) 

[FontSpec.cs:11](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX/Typography/FontSpec.cs#L11)

## Methods

 `public FontSpec Clone()` [#](#method-clone) 

[FontSpec.cs:79](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX/Typography/FontSpec.cs#L79)

Creates a copy that can be modified independently.

Returns

 `FontSpec` 

 `public static FontSpec FromFamily(string family)` [#](#method-fromfamily-string) 

[FontSpec.cs:95](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX/Typography/FontSpec.cs#L95)

Creates a font specification for a family or fallback stack.

Parameters

**family string required**

Returns

 `FontSpec` 

 `public static FontSpec FromFile(string path, int? collectionIndex = null, string? faceName = null)` [#](#method-fromfile-string-nullable-system-int32-string) 

[FontSpec.cs:98](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX/Typography/FontSpec.cs#L98)

Creates a font specification backed by a TrueType font file.

Parameters

**path string required**

**collectionIndex int? = null optional**

**faceName string? = null optional**

Returns

 `FontSpec` 

 `public static FontSpec SystemSans()` [#](#method-systemsans) 

[FontSpec.cs:92](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX/Typography/FontSpec.cs#L92)

Creates a system sans-serif font specification.

Returns

 `FontSpec` 

 `public FontSpec Variation(string tag, double value)` [#](#method-variation-string-double) 

[FontSpec.cs:34](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX/Typography/FontSpec.cs#L34)

Selects an explicit variation axis in design units.

Parameters

**tag string required**

**value double required**

Returns

 `FontSpec` 

## Inherited Methods

 `public virtual bool Equals(object? obj)` [#](#method-equals-object) 

Inherited from object

Parameters

**obj object? required**

Returns

 `bool` 

 `public virtual int GetHashCode()` [#](#method-gethashcode) 

Inherited from object

Returns

 `int` 

 `public Type GetType()` [#](#method-gettype) 

Inherited from object

Returns

 `Type` 

 `public virtual string? ToString()` [#](#method-tostring) 

Inherited from object

Returns

 `string?` 

## Properties

 `public int ColorPaletteIndex { get; set; }` [#](#property-colorpaletteindex) 

[FontSpec.cs:21](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX/Typography/FontSpec.cs#L21)

Gets or sets the zero-based CPAL palette index. Zero is the default. Missing or unusable palettes fall back to the font's default palette; bitmap glyphs are unaffected.

 `public FontVariationSettings Variations { get; set; }` [#](#property-variations) 

[FontSpec.cs:31](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX/Typography/FontSpec.cs#L31)

Gets or sets immutable OpenType axis coordinates. The default uses the face's default instance; Weight and Italic retain their existing face-selection policy.

 `public string Family { get; set; }` [#](#property-family) 

[FontSpec.cs:38](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX/Typography/FontSpec.cs#L38)

Gets or sets the CSS-compatible family or fallback stack.

 `public string? FilePath { get; set; }` [#](#property-filepath) 

[FontSpec.cs:47](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX/Typography/FontSpec.cs#L47)

Gets or sets an optional TrueType or TrueType collection path used by raster output.

 `public int? CollectionIndex { get; set; }` [#](#property-collectionindex) 

[FontSpec.cs:53](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX/Typography/FontSpec.cs#L53)

Gets or sets an optional TrueType collection face index.

 `public string? FaceName { get; set; }` [#](#property-facename) 

[FontSpec.cs:62](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX/Typography/FontSpec.cs#L62)

Gets or sets an optional face name used when selecting a collection member.

 `public int Weight { get; set; }` [#](#property-weight) 

[FontSpec.cs:68](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX/Typography/FontSpec.cs#L68)

Gets or sets the CSS numeric font weight from 1 through 1000, independently of available font faces.

 `public bool Italic { get; set; }` [#](#property-italic) 

[FontSpec.cs:76](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX/Typography/FontSpec.cs#L76)

Gets or sets a value indicating whether an italic face is preferred.

## Extension Methods

 `public static FontSpec CollectionIndex(FontSpec fontSpec, int? value)` [#](#extension-collectionindex-chartforgex-typography-fontspec-nullable-system-int32) 

Sets [FontSpec.CollectionIndex](/api/chartforgex-typography-fontspec/): Gets or sets an optional TrueType collection face index.

Parameters

**fontSpec ChartForgeX.Typography.FontSpec required**

The instance.

**value int? required**

The value.

Returns

 `FontSpec` The same instance. 

Examples

```csharp
// C# initializer or property                                               // C# fluent
new global::ChartForgeX.Typography.FontSpec { CollectionIndex = value };    fontSpec.CollectionIndex(value);
```

 `public static FontSpec ColorPaletteIndex(FontSpec fontSpec, int value)` [#](#extension-colorpaletteindex-chartforgex-typography-fontspec-int32) 

Sets [FontSpec.ColorPaletteIndex](/api/chartforgex-typography-fontspec/): Gets or sets the zero-based CPAL palette index. Zero is the default. Missing or unusable palettes fall back to the font's default palette; bitmap glyphs are unaffected.

Parameters

**fontSpec ChartForgeX.Typography.FontSpec required**

The instance.

**value int required**

The value.

Returns

 `FontSpec` The same instance. 

Examples

```csharp
// C# initializer or property                                                 // C# fluent
new global::ChartForgeX.Typography.FontSpec { ColorPaletteIndex = value };    fontSpec.ColorPaletteIndex(value);
```

 `public static FontSpec FaceName(FontSpec fontSpec, string? value)` [#](#extension-facename-chartforgex-typography-fontspec-string) 

Sets [FontSpec.FaceName](/api/chartforgex-typography-fontspec/): Gets or sets an optional face name used when selecting a collection member.

Parameters

**fontSpec ChartForgeX.Typography.FontSpec required**

The instance.

**value string? required**

The value.

Returns

 `FontSpec` The same instance. 

Examples

```csharp
// C# initializer or property                                        // C# fluent
new global::ChartForgeX.Typography.FontSpec { FaceName = value };    fontSpec.FaceName(value);
```

 `public static FontSpec Family(FontSpec fontSpec, string value)` [#](#extension-family-chartforgex-typography-fontspec-string) 

Sets [FontSpec.Family](/api/chartforgex-typography-fontspec/): Gets or sets the CSS-compatible family or fallback stack.

Parameters

**fontSpec ChartForgeX.Typography.FontSpec required**

The instance.

**value string required**

The value.

Returns

 `FontSpec` The same instance. 

Examples

```csharp
// C# initializer or property                                      // C# fluent
new global::ChartForgeX.Typography.FontSpec { Family = value };    fontSpec.Family(value);
```

 `public static FontSpec FilePath(FontSpec fontSpec, string? value)` [#](#extension-filepath-chartforgex-typography-fontspec-string) 

Sets [FontSpec.FilePath](/api/chartforgex-typography-fontspec/): Gets or sets an optional TrueType or TrueType collection path used by raster output.

Parameters

**fontSpec ChartForgeX.Typography.FontSpec required**

The instance.

**value string? required**

The value.

Returns

 `FontSpec` The same instance. 

Examples

```csharp
// C# initializer or property                                        // C# fluent
new global::ChartForgeX.Typography.FontSpec { FilePath = value };    fontSpec.FilePath(value);
```

 `public static FontSpec Italic(FontSpec fontSpec, bool value = true)` [#](#extension-italic-chartforgex-typography-fontspec-boolean) 

Sets [FontSpec.Italic](/api/chartforgex-typography-fontspec/): Gets or sets a value indicating whether an italic face is preferred.

Parameters

**fontSpec ChartForgeX.Typography.FontSpec required**

The instance.

**value bool = true optional**

The value; true when omitted.

Returns

 `FontSpec` The same instance. 

Examples

```csharp
// C# initializer or property                                      // C# fluent
new global::ChartForgeX.Typography.FontSpec { Italic = value };    fontSpec.Italic(value);
```

 `public static FontSpec Variations(FontSpec fontSpec, FontVariationSettings value)` [#](#extension-variations-chartforgex-typography-fontspec-chartforgex-typography-fontvariationsettings) 

Sets [FontSpec.Variations](/api/chartforgex-typography-fontspec/): Gets or sets immutable OpenType axis coordinates. The default uses the face's default instance; Weight and Italic retain their existing face-selection policy.

Parameters

**fontSpec ChartForgeX.Typography.FontSpec required**

The instance.

**value ChartForgeX.Typography.FontVariationSettings required**

The value.

Returns

 `FontSpec` The same instance. 

Examples

```csharp
// C# initializer or property                                          // C# fluent
new global::ChartForgeX.Typography.FontSpec { Variations = value };    fontSpec.Variations(value);
```

 `public static FontSpec Weight(FontSpec fontSpec, int value)` [#](#extension-weight-chartforgex-typography-fontspec-int32) 

Sets [FontSpec.Weight](/api/chartforgex-typography-fontspec/): Gets or sets the CSS numeric font weight from 1 through 1000, independently of available font faces.

Parameters

**fontSpec ChartForgeX.Typography.FontSpec required**

The instance.

**value int required**

The value.

Returns

 `FontSpec` The same instance. 

Examples

```csharp
// C# initializer or property                                      // C# fluent
new global::ChartForgeX.Typography.FontSpec { Weight = value };    fontSpec.Weight(value);
```

<!-- PowerForge markdown artifact sha256:2F00A9A00AF0E60F07B74B2B7C055B1869A9DA3EBD123F485349619BD42B25B0 -->
