public PFont createFont(String name, float size,
                          boolean smooth, char charset[]) {
    String lowerName = name.toLowerCase();
    Font baseFont = null;

    try {
      if (lowerName.endsWith(".otf") || lowerName.endsWith(".ttf")) {
        InputStream stream = createInput(name);
        if (stream == null) {
          System.err.println("The font \"" + name + "\" " +
                             "is missing or inaccessible, make sure " +
                             "the URL is valid or that the file has been " +
                             "added to your sketch and is readable.");
          return null;
        }
        baseFont = Font.createFont(Font.TRUETYPE_FONT, createInput(name));

      } else {
        //baseFont = new Font(name, Font.PLAIN, 1);
        baseFont = PFont.findFont(name);
      }
    } catch (Exception e) {
      System.err.println("Problem using createFont() with " + name);
      e.printStackTrace();
    }
    return new PFont(baseFont.deriveFont(size), smooth, charset);
  }