Reference · Callback interface · lib.rs

FontLocator Callback interface

What a platform brings for stamp text the bundled font cannot draw (Chinese, Arabic, Hebrew …): which of its fonts draws a text (Apple: CoreText's fallback, Windows: DirectWrite's). The engine opens the file, lays the text out and embeds only the glyphs it uses.

protocol FontLocator {
    func locate(text: String, bold: Bool) -> [SystemFont]
}

Methods you implement

locate

The fonts that could draw text (at least its first character), bold if asked, the system's own choice first. The engine skips files a PDF cannot carry and picks the one that draws most of the text.

func locate(text: String, bold: Bool) -> [SystemFont]

Parameters

NameTypeSwift / C#
textStringtext
boldboolbold

Returns

Vec<SystemFont>

Errors

Does not throw.

Used by

set_font_locator

Signatures are generated from the engine’s code. Swift is checked against the generated bindings; C# follows the bindings generator’s naming rules.