---
title: "Read a font’s PostScript name in C#"
url: https://recursiveai.org/onefont/cookbook/read-font-postscript-name/
description: "Read a font’s PostScript name from an OpenType or TrueType file in C#. Get the stored face identifier, tell it apart from the family name, and handle a missing value."
version: "1.4.0"
---

# Read a font’s PostScript name in C#

**onefont** is a free, open-source font and text-shaping library for .NET from Recursive AI. MIT or Apache-2.0, no native dependencies.

[NuGet](https://www.nuget.org/packages/RecursiveAI.OneFont) · [GitHub](https://github.com/recursive-ai-oss/onefont-csharp) · [Docs](https://recursiveai.org/onefont/docs/) · [Download example (.zip)](https://recursiveai.org/onefont/cookbook/read-font-postscript-name/read-font-postscript-name.zip)

Read the PostScript name stored in the font, not its filename. Use a `.ttf` or supported `.otf` file. `NotoSans-Regular.ttf` is in the download.

```shell
dotnet add package RecursiveAI.OneFont
```

Requires [.NET 10](https://dotnet.microsoft.com/download/dotnet/10.0) (net10.0); .NET 9 and earlier aren’t supported.

```csharp
using OneFont;

var face = FontFace.Load(File.ReadAllBytes(
    "NotoSans-Regular.ttf"));
var name = face.PostScriptName;
Console.WriteLine(name ?? "No PostScript name");
```

Unzip [the example](https://recursiveai.org/onefont/cookbook/read-font-postscript-name/read-font-postscript-name.zip), then `dotnet run`.

Prints:

```text
NotoSans-Regular
```

## The full program

```csharp
using OneFont;

string path = args.Length == 0
    ? "NotoSans-Regular.ttf" : args[0];
var face = FontFace.Load(File.ReadAllBytes(path));
Console.WriteLine(face.PostScriptName ?? "No PostScript name");
```

With the included font, `dotnet run` prints `NotoSans-Regular`.

The download contains the unchanged [Noto Sans Regular font](https://github.com/notofonts/notofonts.github.io/blob/ac9cdcd317b3c34c7578f609189c963c7eeff3c5/fonts/NotoSans/hinted/ttf/NotoSans-Regular.ttf) and its SIL Open Font License. To inspect your own font, run `dotnet run -- "path/to/font.ttf"`.

If the font has no PostScript name, you get `null`. If `FontFace.Load` can’t read the font data because it’s malformed or unsupported, it throws `FontFormatException`.

## Variations

To show a display name too, append this line to the snippet at the top:

```csharp
Console.WriteLine(face.FamilyName);
```

The extra line prints `Noto Sans`.

## Related recipes

- [Read a font family name in C#](https://recursiveai.org/onefont/cookbook/read-font-family-name/)
- [Read a font file](https://recursiveai.org/onefont/cookbook/read-font-file/)

---

## The short answer

Read `FontFace.PostScriptName` for the stored PostScript identifier. If the result is `null`, report the name as missing; stripping spaces from `FamilyName` or dropping the extension from the filename won’t retrieve the stored value.

## What’s the difference between a PostScript name and a font family name?

A family name groups related faces in a font menu. With the bundled font, that label is `Noto Sans`, while the PostScript name identifies the regular face as `NotoSans-Regular`. `FullName` is another human-readable field; it includes the style here (`Noto Sans Regular`). Use the family name to group faces and the PostScript name when an input or output field specifically asks for it.

The [OpenType naming table specification](https://learn.microsoft.com/en-us/typography/opentype/spec/name#name-ids) defines those as separate records: name ID 6 is the PostScript name, ID 4 is the full name, and IDs 16 and 1 are the typographic and legacy family names. It limits the PostScript name to 63 characters in a restricted printable ASCII range that excludes spaces. That explains why it often looks different from the menu label. It doesn’t give you a recipe to turn one into the other.

## How do I find the PostScript name inside a font file?

The extension tells you the kind of file, not the name stored in it. OneFont reads name ID 6 from the face’s `name` table; it doesn’t get this identifier from the `post` table or from a system font menu. The font doesn’t have to be installed. Renaming the file doesn’t change the ID 6 record, even though the example’s filename happens to match the name it prints.

A `.ttc` font collection can contain multiple faces. `FontFace.Load` defaults to the first face, index `0`. Its `faceIndex` parameter selects a different face from the same file; choose the index for the style you need rather than treating the collection as a single face. The [pinned load API](https://github.com/recursive-ai-oss/onefont-csharp/blob/7db48bc21a7eec46272aa73f4e76acf07645db03/src/OneFont/FontFace.cs#L26-L40) documents the accepted formats and the zero-based index. WOFF, WOFF2 and CFF2 aren’t supported at this release.
