public void textFont(PFont which) {
    super.textFont(which);

    // Make sure a native version of the font is available.
    if (textFont.getFont() == null) {
      throw new RuntimeException(
          "Use createFont() instead of loadFont() " + "when drawing text using the PDF library.");
    }
    // Make sure that this is a font that the PDF library can deal with.
    if (!checkFont(which.getName())) {
      System.err.println("Use PGraphicsPDF.listFonts() to get a list of available fonts.");
      throw new RuntimeException(
          "The font “" + which.getName() + "” cannot be used with PDF Export.");
    }
  }