resolve method

PdfFont resolve(
  1. PdfDocument document
)

Implementation

PdfFont resolve(PdfDocument document) {
  final cached = _cache[document];
  if (cached != null) return cached;

  PdfFont font;
  final bytes = _ttfBytes;
  if (bytes != null) {
    font = PdfTtfFont(document, ByteData.sublistView(bytes));
  } else {
    switch (family ?? PdfVisualFontFamily.helvetica) {
      case PdfVisualFontFamily.helvetica:
        font = style == PdfVisualFontStyle.bold
            ? PdfFont.helveticaBold(document)
            : PdfFont.helvetica(document);
        break;
    }
  }
  _cache[document] = font;
  return font;
}