init method

Future<void> init([
  1. Set<String> requiredFamilies = const {}
])

Initializes the provider by loading all necessary fonts. requiredFamilies are the font families actually used in the document; the provider tries to load them from the OS so the PDF embeds the real fonts.

Implementation

Future<void> init([Set<String> requiredFamilies = const {}]) async {
  if (_initialized) return;

  // Load bundled fonts (fallback)
  await _loadBundledFonts();

  // Load any system fonts that match families used in the document
  for (final family in requiredFamilies) {
    if (family.trim().isEmpty) continue;
    await _tryLoadSystemFont(family);
  }

  _initialized = true;
}