Method MissingGlyphHandler
- Namespace
- BitMiracle.Docotic.Pdf.Layout
- Assembly
- BitMiracle.Docotic.Pdf.Layout.dll
MissingGlyphHandler(PdfMissingGlyphMapper?)
Sets the handler for glyphs that cannot be drawn using the TextStyle font or its fallbacks.
public PdfDocumentBuilder MissingGlyphHandler(PdfMissingGlyphMapper? mapper)
Parameters
mapper
PdfMissingGlyphMapperThe handler to substitute text for glyphs that cannot be drawn. When the value is
null
then CannotShowTextException will be thrown for missing glyphs.
Returns
- PdfDocumentBuilder
The updated builder.
Remarks
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.