PdfFontProvider class

Provides TTF fonts for PDF generation.

Strategy:

  1. Loads DejaVu fonts bundled in the package assets
  2. Last fallback: built-in PDF fonts (Helvetica, etc.)

DejaVu Sans has extended Unicode coverage (bullet, check marks, em-dash, ballot boxes, etc.) - Bitstream Vera license + public domain.

Supports 3 families: sans-serif, serif, monospace. Each family has 4 variants: regular, bold, italic, bold-italic.

Constructors

PdfFontProvider()

Properties

hashCode int
The hash code for this object.
no setterinherited
monoBold ↔ Font?
getter/setter pair
monoRegular ↔ Font?
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
sansBold ↔ Font?
getter/setter pair
sansBoldItalic ↔ Font?
getter/setter pair
sansItalic ↔ Font?
getter/setter pair
sansRegular ↔ Font?
getter/setter pair
serifBold ↔ Font?
getter/setter pair
serifBoldItalic ↔ Font?
getter/setter pair
serifItalic ↔ Font?
getter/setter pair
serifRegular ↔ Font?
getter/setter pair

Methods

getFontSet(String fontFamily, String? styleName) → ({Font bold, Font boldItalic, Font italic, Font regular})
Returns the set of 4 fonts (regular, bold, italic, bold-italic) for a given font family.
init([Set<String> requiredFamilies = const {}]) Future<void>
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.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
selectFont(String fontFamily, String? styleName, {bool bold = false, bool italic = false}) → Font
Selects the correct font based on bold/italic. If the family was loaded dynamically from the OS, uses the specific variant.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited