---
title: "Class FontService | Customer's Canvas On-Premises"
canonical: "https://customerscanvas.com/docs/on-premises/design-atoms-cs/reference/api/Aurigma.DesignAtoms.Services/FontService/"
---

# Class FontService

> **Inheritance:** `System.Object` -> FontService

###### **Namespace**: [Aurigma.DesignAtoms.Services](https://customerscanvas.com/docs/on-premises/design-atoms-cs/reference/api/Aurigma.DesignAtoms.Services.md)

###### **Assembly**: Aurigma.DesignAtoms.dll

```csharp title="Syntax"
public class FontService : IFontService, IDisposable
```

## Implements

* [Aurigma.DesignAtoms.Services.IFontService](https://customerscanvas.com/docs/on-premises/design-atoms-cs/reference/api/Aurigma.DesignAtoms.Services/IFontService.md)
* `System.IDisposable`

## Inherited Members

* `System.Object.ToString`
* `System.Object.Equals(System.Object)`
* `System.Object.Equals(System.Object,System.Object)`
* `System.Object.ReferenceEquals(System.Object,System.Object)`
* `System.Object.GetHashCode`
* `System.Object.GetType`
* `System.Object.MemberwiseClone`

## Constructors

### FontService

```csharp
public FontService(IConfiguration configuration, IFontStorage fontStorage, IFontInfoProvider fontInfoProvider, bool initialize = true)
```

## Properties

### LocalFonts

```csharp
public virtual IReadOnlyDictionary<string, IList<FontService.FontData>> LocalFonts { get; }
```

### AllFontsByFamily

```csharp
public IReadOnlyDictionary<string, IList<FontService.FontData>> AllFontsByFamily { get; }
```

### AllFontsByPsName

```csharp
public IReadOnlyDictionary<string, FontService.FontData> AllFontsByPsName { get; }
```

### FontRemaps

```csharp
public IReadOnlyDictionary<string, string> FontRemaps { get; }
```

### FontSizeWarningThreshold

```csharp
public long FontSizeWarningThreshold { get; }
```

### DefaultPostscriptName

```csharp
public string DefaultPostscriptName { get; }
```

### FontRegistry

```csharp
public FontRegistry FontRegistry { get; }
```

## Methods

### Dispose

```csharp
public void Dispose()
```

### GetCompressedFontStreamAsync

```csharp
public Task<Stream> GetCompressedFontStreamAsync(string postscriptName)
```

##### Parameters

| Type | Name | Description |
|:---|:---|:---|
| `System.String` | *postscriptName* |  |

##### Returns

`System.Threading.Tasks.Task<System.IO.Stream>`

### GetCompressedFontStream

```csharp
[Obsolete("This method is obsolete, use GetCompressedFontStream instead.")]
public Task<Stream> GetCompressedFontStream(string postscriptName)
```

##### Parameters

| Type | Name | Description |
|:---|:---|:---|
| `System.String` | *postscriptName* |  |

##### Returns

`System.Threading.Tasks.Task<System.IO.Stream>`

### GetFontRegistry

```csharp
public FontRegistry GetFontRegistry()
```

##### Returns

`Aurigma.GraphicsMill.AdvancedDrawing.FontRegistry`

### CreateFont

```csharp
public Font CreateFont(FontRegistry fontRegistry, string postScriptName, float size, float dpiX, float dpiY)
```

##### Parameters

| Type | Name | Description |
|:---|:---|:---|
| `Aurigma.GraphicsMill.AdvancedDrawing.FontRegistry` | *fontRegistry* |  |
| `System.String` | *postScriptName* |  |
| `System.Single` | *size* |  |
| `System.Single` | *dpiX* |  |
| `System.Single` | *dpiY* |  |

##### Returns

`Aurigma.GraphicsMill.AdvancedDrawing.Font`

### InitializeAsync

```csharp
public Task InitializeAsync()
```

##### Returns

`System.Threading.Tasks.Task`

### WaitUntilReadyAsync

```csharp
public Task WaitUntilReadyAsync()
```

##### Returns

`System.Threading.Tasks.Task`

### UpdateLocalFonts

```csharp
[Obsolete]
public void UpdateLocalFonts()
```

### GetBytes

```csharp
public IEnumerable<byte> GetBytes()
```

##### Returns

`System.Collections.Generic.IEnumerable<System.Byte>`

### RecognizeFontStyle

```csharp
public FontService.FontStyle RecognizeFontStyle(string style)
```

##### Parameters

| Type | Name | Description |
|:---|:---|:---|
| `System.String` | *style* |  |

##### Returns

[Aurigma.DesignAtoms.Services.FontService.FontStyle](https://customerscanvas.com/docs/on-premises/design-atoms-cs/reference/api/Aurigma.DesignAtoms.Services/FontService.FontStyle.md)

### GetCssPsName

```csharp
public string GetCssPsName(FontService.FontData requestedFont)
```

##### Parameters

| Type | Name | Description |
|:---|:---|:---|
| [Aurigma.DesignAtoms.Services.FontService.FontData](https://customerscanvas.com/docs/on-premises/design-atoms-cs/reference/api/Aurigma.DesignAtoms.Services/FontService.FontData.md) | *requestedFont* |  |

##### Returns

`System.String`

### GetCssFamilyName

```csharp
public string GetCssFamilyName(FontService.FontData requestedFont)
```

##### Parameters

| Type | Name | Description |
|:---|:---|:---|
| [Aurigma.DesignAtoms.Services.FontService.FontData](https://customerscanvas.com/docs/on-premises/design-atoms-cs/reference/api/Aurigma.DesignAtoms.Services/FontService.FontData.md) | *requestedFont* |  |

##### Returns

`System.String`

### FindSuitableFont

```csharp
public FontSettings FindSuitableFont(string fontFamily, bool requestedBold = false, bool requestedItalic = false, string requestedStyle = null)
```

##### Parameters

| Type | Name | Description |
|:---|:---|:---|
| `System.String` | *fontFamily* |  |
| `System.Boolean` | *requestedBold* |  |
| `System.Boolean` | *requestedItalic* |  |
| `System.String` | *requestedStyle* |  |

##### Returns

[Aurigma.DesignAtoms.Model.Items.FontSettings](https://customerscanvas.com/docs/on-premises/design-atoms-cs/reference/api/Aurigma.DesignAtoms.Model.Items/FontSettings.md)

### FilterMissedFontsByPsNames

```csharp
public IEnumerable<string> FilterMissedFontsByPsNames(IEnumerable<string> requestedFontsPsNames)
```

##### Parameters

| Type | Name | Description |
|:---|:---|:---|
| `System.Collections.Generic.IEnumerable<System.String>` | *requestedFontsPsNames* |  |

##### Returns

`System.Collections.Generic.IEnumerable<System.String>`

### FilterMissedFontsByFontFamilyAndStyle&gt;)

```csharp
public IEnumerable<string> FilterMissedFontsByFontFamilyAndStyle(IEnumerable<(string, string)> requestedFonts)
```

##### Parameters

| Type | Name | Description |
|:---|:---|:---|
| `System.Collections.Generic.IEnumerable<System.ValueTuple<System.String,System.String>>` | *requestedFonts* |  |

##### Returns

`System.Collections.Generic.IEnumerable<System.String>`

### CreateProductAvailableFontsAsync

```csharp
public Task<Dictionary<string, IEnumerable<FontService.ExtendedFontData>>> CreateProductAvailableFontsAsync(IProductHandler productHandler, Product product, IList<string> requestedLocalFonts, string requestedDefaultFont)
```

##### Parameters

| Type | Name | Description |
|:---|:---|:---|
| [Aurigma.DesignAtoms.Model.IProductHandler](https://customerscanvas.com/docs/on-premises/design-atoms-cs/reference/api/Aurigma.DesignAtoms.Model/IProductHandler.md) | *productHandler* |  |
| [Aurigma.DesignAtoms.Model.Product](https://customerscanvas.com/docs/on-premises/design-atoms-cs/reference/api/Aurigma.DesignAtoms.Model/Product.md) | *product* |  |
| `System.Collections.Generic.IList<System.String>` | *requestedLocalFonts* |  |
| `System.String` | *requestedDefaultFont* |  |

##### Returns

`System.Threading.Tasks.Task<System.Collections.Generic.Dictionary<System.String,System.Collections.Generic.IEnumerable<Aurigma.DesignAtoms.Services.FontService.ExtendedFontData>>>`

### CreateProductAvailableFonts1

```csharp
[Obsolete]
public Dictionary<string, IEnumerable<FontService.ExtendedFontData>> CreateProductAvailableFonts1(IProductHandler productHandler, Product product, IList<string> requestedLocalFonts, string requestedDefaultFont)
```

##### Parameters

| Type | Name | Description |
|:---|:---|:---|
| [Aurigma.DesignAtoms.Model.IProductHandler](https://customerscanvas.com/docs/on-premises/design-atoms-cs/reference/api/Aurigma.DesignAtoms.Model/IProductHandler.md) | *productHandler* |  |
| [Aurigma.DesignAtoms.Model.Product](https://customerscanvas.com/docs/on-premises/design-atoms-cs/reference/api/Aurigma.DesignAtoms.Model/Product.md) | *product* |  |
| `System.Collections.Generic.IList<System.String>` | *requestedLocalFonts* |  |
| `System.String` | *requestedDefaultFont* |  |

##### Returns

`System.Collections.Generic.Dictionary<System.String,System.Collections.Generic.IEnumerable<Aurigma.DesignAtoms.Services.FontService.ExtendedFontData>>`

### GetFontStreamByPostscriptNameAsync

```csharp
public Task<Stream> GetFontStreamByPostscriptNameAsync(string psName)
```

##### Parameters

| Type | Name | Description |
|:---|:---|:---|
| `System.String` | *psName* |  |

##### Returns

`System.Threading.Tasks.Task<System.IO.Stream>`

### GetFontStreamByPostscriptName

```csharp
[Obsolete("This method is obsolete, use GetFontStreamByPostscriptNameAsync instead.")]
public Task<Stream> GetFontStreamByPostscriptName(string psName)
```

##### Parameters

| Type | Name | Description |
|:---|:---|:---|
| `System.String` | *psName* |  |

##### Returns

`System.Threading.Tasks.Task<System.IO.Stream>`

### GetFontPath

```csharp
public string GetFontPath(string fontKey)
```

##### Parameters

| Type | Name | Description |
|:---|:---|:---|
| `System.String` | *fontKey* |  |

##### Returns

`System.String`

### GetFontStreamByPathAsync

```csharp
public Task<Stream> GetFontStreamByPathAsync(string fontPath)
```

##### Parameters

| Type | Name | Description |
|:---|:---|:---|
| `System.String` | *fontPath* |  |

##### Returns

`System.Threading.Tasks.Task<System.IO.Stream>`

### GetFontStreamByPath

```csharp
[Obsolete("This method is obsolete, use GetFontStreamByPathAsync instead.")]
public Task<Stream> GetFontStreamByPath(string fontPath)
```

##### Parameters

| Type | Name | Description |
|:---|:---|:---|
| `System.String` | *fontPath* |  |

##### Returns

`System.Threading.Tasks.Task<System.IO.Stream>`

### FixFontPsName

```csharp
public string FixFontPsName(string psName)
```

##### Parameters

| Type | Name | Description |
|:---|:---|:---|
| `System.String` | *psName* |  |

##### Returns

`System.String`

### GetFontKey

```csharp
public static string GetFontKey(string postScriptName, string fontFileFullName)
```

##### Parameters

| Type | Name | Description |
|:---|:---|:---|
| `System.String` | *postScriptName* |  |
| `System.String` | *fontFileFullName* |  |

##### Returns

`System.String`

### GetFontMimeType

```csharp
public static string GetFontMimeType(string fileName)
```

##### Parameters

| Type | Name | Description |
|:---|:---|:---|
| `System.String` | *fileName* |  |

##### Returns

`System.String`
