---
title: "onefont cookbook"
url: https://recursiveai.org/onefont/cookbook/
description: "Short recipes for common onefont tasks, each with complete code you can copy."
version: "1.3.0"
---

# onefont cookbook

Short recipes for common onefont tasks, each with complete code you can copy.

## Recipes

- [Read a TTF or OTF font file](https://recursiveai.org/onefont/cookbook/read-font-file/index.md): Read a font’s names, style, metrics and tables in C# from a TTF, OTF or TTC file, on any platform, and tell TrueType outlines from CFF.
- [Check if a font supports a character](https://recursiveai.org/onefont/cookbook/font-supports-character/index.md): Find out in C# whether a font has a glyph for a character, list the characters it lacks, and fall back to other fonts cluster by cluster.
- [Measure and wrap text](https://recursiveai.org/onefont/cookbook/measure-and-wrap-text/index.md): Measure the width of a string in C# from the font itself, with kerning and ligatures, and wrap a paragraph at Unicode line break opportunities, without…
- [Convert text to SVG paths](https://recursiveai.org/onefont/cookbook/text-to-svg-path/index.md): Turn a string into SVG path data in C#: shape it with the font’s ligatures and kerning, then write each glyph’s outline through a sink that emits SVG…
- [Right-to-left and mixed-direction text](https://recursiveai.org/onefont/cookbook/right-to-left-text/index.md): Lay out Arabic, Hebrew and mixed-direction text in C#: resolve the Unicode bidi levels, cut the paragraph into runs, put the runs in display order, and…
- [Turn on OpenType features](https://recursiveai.org/onefont/cookbook/opentype-features/index.md): Switch OpenType features such as small caps, figure styles, fractions and ligatures on or off in C#, and choose a language’s local forms, with ShapingOptions.
- [Shape complex scripts](https://recursiveai.org/onefont/cookbook/complex-scripts/index.md): Shape Hindi, other Indic scripts and Thai in C# with onefont: syllables, conjuncts, reordered vowel signs and stacked marks, and which character each…
- [Find caret positions and hit-test text](https://recursiveai.org/onefont/cookbook/caret-positions/index.md): Compute caret positions for shaped text in C#, including inside ligatures, and map a click’s x coordinate back to an index in the string.
- [Shape many runs without allocating](https://recursiveai.org/onefont/cookbook/shape-without-allocating/index.md): Shape thousands of strings in C# with no garbage per call: reuse a ShapedRun and a ShapingOptions, and read clusters and glyphs from spans.
