PdfDocumentBuilder.MissingGlyphHandler Method

Sets the handler for glyphs that cannot be drawn using the TextStyle font or its fallbacks.

Namespace:  BitMiracle.Docotic.Pdf.Layout
Assembly:  BitMiracle.Docotic.Pdf.Layout (in BitMiracle.Docotic.Pdf.Layout.dll)

Syntax

C#
public PdfDocumentBuilder MissingGlyphHandler(
	PdfMissingGlyphMapper? mapper
)
VB
Public Function MissingGlyphHandler ( 
	mapper As PdfMissingGlyphMapper
) As PdfDocumentBuilder

Parameters

mapper
Type: BitMiracle.Docotic.Pdf.PdfMissingGlyphMapper
The handler to substitute text for glyphs that cannot be drawn. When the value is null then CannotShowTextException will be thrown for missing glyphs.

Return Value

Type: 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(TextStyle) 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.

See Also