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]
}public interface FontLocator {
SystemFont[] Locate(string text, bool bold);
}pub trait FontLocator: Send + Sync {
fn locate(&self, text: String, bold: bool) -> Vec<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]SystemFont[] Locate(string text, bool bold)pub fn locate(&self, text: String, bold: bool) -> Vec<SystemFont>Parameters
| Name | Type | Swift / C# |
|---|---|---|
text | String | text |
bold | bool | bold |
Returns
Vec<SystemFont>
Errors
Does not throw.
Used by
Signatures are generated from the engine’s code. Swift is checked against the generated bindings; C# follows the bindings generator’s naming rules.