toPdfTextStyle method

Future<TextStyle> toPdfTextStyle(
  1. FontData fontData
)

Implementation

Future<pw.TextStyle> toPdfTextStyle(FontData fontData) async {
  pw.Font? font = fontFamily != null
    ? await resolveFont(fontFamily!, fontData)
    : null;
  return pw.TextStyle(
      color: color?.toPdfColor(),
      fontSize: fontSize,
      fontStyle: fontStyle?.toPdfFontStyle(),
      fontWeight: fontWeight?.toPdfFontWeight(),
      height: height,
      letterSpacing: letterSpacing,
      wordSpacing: wordSpacing,
      decoration: decoration?.toPdfTextDecoration(),
      decorationColor: decorationColor?.toPdfColor(),
      decorationStyle: decorationStyle?.toPdfTextDecorationStyle(),
      decorationThickness: decorationThickness,
      inherit: !inherit && font == null ? true : inherit,
      font: font,
      fontFallback: fontFamilyFallback != null
          ? (await Future.wait(fontFamilyFallback!
              .map((String font) => resolveFont(font, fontData))))
              .whereType<pw.Font>().toList()
          : [],
      background: backgroundColor != null
          ? pw.BoxDecoration(
              color: backgroundColor!.toPdfColor(),
            )
          : null,
    );
}