Skip to main content

Troubleshooting

FontFamilyNotFoundException for an installed font​

  • Check the name. Get matches the family name, such as Segoe UI, not the full name such as Segoe UI Bold, and not the file name. List the names with SystemFonts.Families.
  • On Linux and in containers, the font may not be installed, or may be in a folder that the library does not search. The exception message lists the folders that it searched. See System fonts.
  • WOFF and WOFF2 files in system folders are not loaded. Add them to a FontCollection yourself.

Boxes (tofu) instead of characters​

The font has no glyph for those characters, so the library used its missing-glyph box. Add a font that has them to FallbackFontFamilies. To find the characters, look for glyphs with GlyphType.Fallback in your renderer.

The text is the wrong size​

  • Results are in pixels at TextOptions.Dpi, which is 72 by default. At 72 DPI, a 12pt font is 12 pixels high. For a 96 DPI screen, set Dpi = 96.
  • MeasureAdvance, MeasureSize and MeasureBounds measure different things. See Measuring text.
  • Measure with the same TextOptions that you render with.

The text is upside down​

The library uses a y-axis that points down, as images and screens do. PDF and some graphics systems use a y-axis that points up. Flip the points when you draw: y' = pageHeight - y.

Arabic letters do not join, or Indic text is in the wrong order​

The font does not support the script, or the text came from a fallback that does not. Use a font made for that script, such as a Noto font for it. Check that the text is in logical order, not already reversed.

A long word goes past the wrapping length​

WordBreaking.Standard breaks only where the line-breaking rules allow. Set WordBreaking = WordBreaking.BreakWord to break a word that does not fit.

TabWidth has no effect​

TabWidth works only with fonts that have a glyph for the tab character, and most do not. See Wrapping and alignment.

Underlines do not appear​

The library does not draw decorations itself. Your renderer must return the decorations from EnabledDecorations and draw the lines it gets in SetDecoration. See Glyph renderers.

Emoji are black and white​

  • The emoji font has no COLR table. Fonts with only bitmap or SVG color glyphs are drawn from their plain outlines. See Color fonts.
  • Your renderer does not implement IColorGlyphRenderer, or ignores SetColor.
  • TextOptions.ColorFontSupport is None.

The build of the repository fails with an SDK error​

global.json pins the .NET 11 SDK, RC2 or later. Install it, or build only your own project against the package. See Installation.