procedure ConfigureSystemFontProvider(const Provider: IPdfSystemFontProvider; const Policy: TPdfSystemFontPolicy);
Installs a process-wide application font mapper through PDFium's native system-font callback interface
Call it before the first LoadLibrary or before opening any TPdf document
Calling it while PDFium is loaded raises EPdfError so native font handles can never outlive their provider configuration
IPdfSystemFontProvider.ResolveFont receives the requested face, weight, italic state, charset, and pitch family
Return True with a face name, full TrueType, TrueType Collection, or OpenType byte array, charset, and optional TTC index
The provider may run on PDFium worker threads and must be thread-safe
Exceptions are contained at the native callback boundary and count as failed provider responses
TPdfSystemFontPolicy.Default allows native fallback and face substitution, limits each supplied font to 64 MiB, and retains up to 32 request results in a bounded LRU cache
Set AllowDefaultFallback to False when every missing-font decision must be made by the application
Set AllowFaceSubstitution to False to reject a response whose face name differs from the requested name
A zero MaxCacheEntries disables request caching
ConfigureSystemFontCacheGovernor can additionally place retained font bytes under a shared cross-cache budget
GetSystemFontProviderStatistics returns a TPdfSystemFontStatistics snapshot covering Configured, Installed, MapRequests, CacheHits, ProviderHits, DefaultFallbackHits, RejectedProviderResponses, FailedRequests, FontDataRequests, ActiveHandles, CachedFonts, CachedFontBytes, and CacheEvictions
The snapshot is safe to query while PDFium is rendering
Call UnloadLibrary before ClearSystemFontProvider
Clearing resets the provider, policy, cache, and statistics
Calling it while PDFium remains loaded raises EPdfError
var
Policy: TPdfSystemFontPolicy;
begin
UnloadLibrary;
Policy := TPdfSystemFontPolicy.Default;
Policy.AllowDefaultFallback := False;
ConfigureSystemFontProvider(MyFontProvider, Policy);
LoadLibrary;
end;