PdfStandardFont.prototype constructor

PdfStandardFont.prototype(
  1. PdfStandardFont prototype,
  2. double size, {
  3. PdfFontStyle? style,
  4. List<PdfFontStyle>? multiStyle,
})

Initializes a new instance of the PdfStandardFont class with PdfStandardFont as prototype, size and font style.

//Create a new PDF document.
PdfDocument document = PdfDocument();
//Create PDF standard font.
PdfFont font = PdfStandardFont.prototype(
    PdfStandardFont(PdfFontFamily.helvetica, 12), 12);
//Draw the text.
document.pages.add().graphics.drawString(
    'The font family name is ${font.fontFamily}', font,
    brush: PdfBrushes.black);
//Save the document.
List<int> bytes = await document.save();
//Close the document.
document.dispose();

Implementation

PdfStandardFont.prototype(PdfStandardFont prototype, double size,
    {PdfFontStyle? style, List<PdfFontStyle>? multiStyle}) {
  _helper = PdfStandardFontHelper(this);
  PdfFontHelper.getHelper(this)
      .initialize(size, style: style, multiStyle: multiStyle);
  _fontFamily = prototype.fontFamily;
  if (style == null && (multiStyle == null || multiStyle.isEmpty)) {
    PdfFontHelper.getHelper(this).setStyle(prototype.style, null);
  }
  _checkStyle();
  _initializeInternals();
}