Sets the handler for glyphs that cannot be drawn using the TextStyle font or its fallbacks.
public PdfDocumentBuilder MissingGlyphHandler(PdfMissingGlyphMapper? mapper)
The handler to substitute text for glyphs that cannot be drawn. When the value is
nullthen CannotShowTextException will be thrown for missing glyphs.
The updated builder.
The default mapper is
null. I.e., CannotShowTextException
will be thrown for missing glyphs.
You can provide fallback fonts using Fallback methods to render glyphs that are not supported by your default font. This handler is used when fallback fonts cannot render some glyph too. In that case, you can either render some placeholder character, skip missing glyphs, or break PDF generation with exception.
You can use the following handler to substitute missing glyphs with a fixed text ("?" in this example):
(glyphText) => "?";
Use the following handler to skip glyphs that cannot be drawn:
(glyphText) => null;
Make sure to return glyph that can be rendered by your fonts.