# CreateFontAsset

> Creates a new font asset instance from the given family name and style.

## Definition

* **Type:** Method
* **Namespace:** [UnityEngine.TextCore.Text](/engine/6000.7/script-reference/unityengine/textcore/text.md)
* **Assembly:** UnityEngine.TextCoreTextEngineModule

## CreateFontAsset(string, string, int)

Creates a new font asset instance from the given family name and style.

```csharp
public static FontAsset CreateFontAsset(string familyName, string styleName, int pointSize = 90)
```

### Parameters

**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): The family name of the source font.**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): The style name of the source font face.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): Optional point size.

### Returns

| Type                                                                                | Description                                  |
| ----------------------------------------------------------------------------------- | -------------------------------------------- |
| [FontAsset](/engine/6000.7/script-reference/unityengine/textcore/text/fontasset.md) | An instance of the newly created font asset. |

## CreateFontAsset(string, string, int, int, GlyphRenderMode)

Creates a new font asset instance from the given family name, style, point size, padding and render mode.

```csharp
public static FontAsset? CreateFontAsset(string familyName, string styleName, int pointSize, int padding, GlyphRenderMode renderMode)
```

### Parameters

**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): The family name of the source font.**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): The style name of the source font face.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The desired point size.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The font padding.**** (\[GlyphRenderMode]\(/engine/6000.7/script-reference/unityengine/textcore/lowlevel/glyphrendermode)): The glyph render mode (ie. sdf vs. bitmap).

### Returns

| Type                                                                                | Description                                  |
| ----------------------------------------------------------------------------------- | -------------------------------------------- |
| [FontAsset](/engine/6000.7/script-reference/unityengine/textcore/text/fontasset.md) | An instance of the newly created font asset. |

## CreateFontAsset(string, int, int, int, GlyphRenderMode, int, int)

Creates a new font asset instance from the font file at the given file path.

```csharp
public static FontAsset CreateFontAsset(string fontFilePath, int faceIndex, int samplingPointSize, int atlasPadding, GlyphRenderMode renderMode, int atlasWidth, int atlasHeight)
```

### Parameters

**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): The file path of the font file.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The index of font face.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The sampling point size.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The padding between individual glyphs in the font atlas texture.**** (\[GlyphRenderMode]\(/engine/6000.7/script-reference/unityengine/textcore/lowlevel/glyphrendermode)): The atlas render mode.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The atlas texture width.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The atlas texture height.

### Returns

| Type                                                                                | Description                                  |
| ----------------------------------------------------------------------------------- | -------------------------------------------- |
| [FontAsset](/engine/6000.7/script-reference/unityengine/textcore/text/fontasset.md) | An instance of the newly created font asset. |

## CreateFontAsset(Font)

Creates a new font asset instance from the provided font object.

```csharp
public static FontAsset CreateFontAsset(Font font)
```

### Parameters

**** (\[Font]\(/engine/6000.7/script-reference/unityengine/font)): The source font object.

### Returns

| Type                                                                                | Description                                  |
| ----------------------------------------------------------------------------------- | -------------------------------------------- |
| [FontAsset](/engine/6000.7/script-reference/unityengine/textcore/text/fontasset.md) | An instance of the newly created font asset. |

## CreateFontAsset(Font, int, int, GlyphRenderMode, int, int, AtlasPopulationMode, bool)

Creates a new font asset instance from the provided font object.

```csharp
public static FontAsset CreateFontAsset(Font font, int samplingPointSize, int atlasPadding, GlyphRenderMode renderMode, int atlasWidth, int atlasHeight, AtlasPopulationMode atlasPopulationMode = AtlasPopulationMode.Dynamic, bool enableMultiAtlasSupport = true)
```

### Parameters

**** (\[Font]\(/engine/6000.7/script-reference/unityengine/font)): The source font object.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The sampling point size.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The padding between individual glyphs in the font atlas texture.**** (\[GlyphRenderMode]\(/engine/6000.7/script-reference/unityengine/textcore/lowlevel/glyphrendermode)): The atlas render mode.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The atlas texture width.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The atlas texture height.**** (\[AtlasPopulationMode]\(/engine/6000.7/script-reference/unityengine/textcore/text/atlaspopulationmode)): The atlas population mode.**** (\[bool]\(https\://learn.microsoft.com/dotnet/api/system.boolean)): Enable multi atlas texture.

### Returns

| Type                                                                                | Description                                  |
| ----------------------------------------------------------------------------------- | -------------------------------------------- |
| [FontAsset](/engine/6000.7/script-reference/unityengine/textcore/text/fontasset.md) | An instance of the newly created font asset. |
