getFont static method

Uint8List? getFont(
  1. String family, {
  2. FontWeight weight = FontWeight.normal,
  3. FontStyle style = FontStyle.normal,
})

Returns the font bytes for the given family, weight, and style.

Returns null if no matching font is registered. Falls back to the normal weight/style variant if the exact match is not found.

Implementation

static Uint8List? getFont(
  String family, {
  FontWeight weight = FontWeight.normal,
  FontStyle style = FontStyle.normal,
}) {
  final familyFonts = _registry[family];
  if (familyFonts == null) return null;
  return familyFonts[_FontKey(weight, style)] ??
      familyFonts[_FontKey(FontWeight.normal, FontStyle.normal)];
}