setCustomFont method

bool setCustomFont(
  1. Uint8List bytes
)

Parses bytes as a TrueType (.ttf) or OpenType (.otf) font and selects it for new free text via activeFont. Returns false when the bytes aren't a usable font (and leaves the selection unchanged).

Implementation

bool setCustomFont(Uint8List bytes) {
  try {
    activeFont = PdfEmbeddedFont.parse(bytes);
    return true;
  } catch (_) {
    return false;
  }
}