SetMissingGlyphCallback

Text, fonts, callbacks

Description

Registers an optional callback that can observe a missing Unicode scalar and select report or abort behavior for that event

Syntax

Delphi

TPDFlibMissingGlyphEvent= Procedure(Sender: TObject;
  CodePoint: Cardinal; UTF16Index, Page: Integer;
  Const FontName, Operation: WideString; Var Action: Integer) Of Object;

PDFlib.OnMissingGlyph:= MissingGlyphHandler;

ActiveX

Function PDFlib::SetMissingGlyphCallback(Callback As Object) As Long

Function Callback.MissingGlyph(CodePoint As Long, UTF16Index As Long,
  Page As Long, FontName As String, Operation As String) As Long

DLL

typedef int (__stdcall *TPDFlibMissingGlyphCallback)(
  uint32_t CodePoint, int UTF16Index, int Page,
  const wchar_t* FontName, const wchar_t* Operation, void* UserData);

int DLSetMissingGlyphCallback(int InstanceID,
  TPDFlibMissingGlyphCallback Callback, void* UserData);

Parameters

CodePointThe complete Unicode scalar value
UTF16IndexThe zero-based source index of the scalar or shaped cluster
PageThe selected one-based page number or zero when no page is active
FontNameThe selected font program or resource name
OperationThe text operation that detected the missing glyph
ActionThe current policy on entry; return or assign 0 to report and drop, or 1 to abort

Return values

The registration methods return 1 for a valid instance

Remarks

The event is added to the retained report before the callback runs

DLL text pointers are read-only and valid only for the duration of the callback

Exceptions crossing the DLL or ActiveX callback boundary are contained and fall back to report-and-drop behavior

See also

SetMissingGlyphPolicy, GetMissingGlyphReportJSON