class PdfAppearance extends PdfTemplate {

    public static final Map<String, PdfName> stdFieldFontNames = new HashMap<>();

    static {
        stdFieldFontNames.put("Courier-BoldOblique", new PdfName("CoBO"));
        stdFieldFontNames.put("Courier-Bold", new PdfName("CoBo"));
        stdFieldFontNames.put("Courier-Oblique", new PdfName("CoOb"));
        stdFieldFontNames.put("Courier", new PdfName("Cour"));
        stdFieldFontNames.put("Helvetica-BoldOblique", new PdfName("HeBO"));
        stdFieldFontNames.put("Helvetica-Bold", new PdfName("HeBo"));
        stdFieldFontNames.put("Helvetica-Oblique", new PdfName("HeOb"));
        stdFieldFontNames.put("Helvetica", PdfName.HELV);
        stdFieldFontNames.put("Symbol", new PdfName("Symb"));
        stdFieldFontNames.put("Times-BoldItalic", new PdfName("TiBI"));
        stdFieldFontNames.put("Times-Bold", new PdfName("TiBo"));
        stdFieldFontNames.put("Times-Italic", new PdfName("TiIt"));
        stdFieldFontNames.put("Times-Roman", new PdfName("TiRo"));
        stdFieldFontNames.put("ZapfDingbats", PdfName.ZADB);
        stdFieldFontNames.put("HYSMyeongJo-Medium", new PdfName("HySm"));
        stdFieldFontNames.put("HYGoThic-Medium", new PdfName("HyGo"));
        stdFieldFontNames.put("HeiseiKakuGo-W5", new PdfName("KaGo"));
        stdFieldFontNames.put("HeiseiMin-W3", new PdfName("KaMi"));
        stdFieldFontNames.put("MHei-Medium", new PdfName("MHei"));
        stdFieldFontNames.put("MSung-Light", new PdfName("MSun"));
        stdFieldFontNames.put("STSong-Light", new PdfName("STSo"));
        stdFieldFontNames.put("MSungStd-Light", new PdfName("MSun"));
        stdFieldFontNames.put("STSongStd-Light", new PdfName("STSo"));
        stdFieldFontNames.put("HYSMyeongJoStd-Medium", new PdfName("HySm"));
        stdFieldFontNames.put("KozMinPro-Regular", new PdfName("KaMi"));
    }

    /**
     * Creates a <CODE>PdfAppearance</CODE>.
     */

    PdfAppearance() {
        super();
        separator = ' ';
    }

    PdfAppearance(PdfIndirectReference iref) {
        thisReference = iref;
    }

    /**
     * Creates new PdfTemplate
     *
     * @param wr the <CODE>PdfWriter</CODE>
     */

    PdfAppearance(PdfWriter wr) {
        super(wr);
        separator = ' ';
    }

    /**
     * Creates a new appearance to be used with form fields.
     *
     * @param writer the PdfWriter to use
     * @param width  the bounding box width
     * @param height the bounding box height
     * @return the appearance created
     */
    public static PdfAppearance createAppearance(PdfWriter writer, float width, float height) {
        return createAppearance(writer, width, height, (PdfName) null);
    }

    private static PdfAppearance createAppearance(PdfWriter writer, float width, float height, PdfName forcedName) {
        PdfAppearance template = new PdfAppearance(writer);
        template.setWidth(width);
        template.setHeight(height);
        writer.addDirectTemplateSimple(template, forcedName);
        return template;
    }

    /**
     * Creates a new appearance to be used with existing form fields. (Create an empty signature appearance with an
     * existing reference).
     *
     * @param writer the PdfWriter to use
     * @param width  the bounding box width
     * @param height the bounding box height
     * @param ref    to be overwritten
     * @return the created appearance
     */
    public static PdfAppearance createAppearance(PdfWriter writer, float width, float height,
            PdfIndirectReference ref) {
        PdfAppearance template = new PdfAppearance(ref);
        template.setWidth(width);
        template.setHeight(height);
        writer.addDirectTemplateSimple(template, null);
        return template;
    }

    /**
     * Set the font and the size for the subsequent text writing.
     *
     * @param bf   the font
     * @param size the font size in points
     */
    public void setFontAndSize(BaseFont bf, float size) {<FILL_FUNCTION_BODY>}

    public PdfContentByte getDuplicate() {
        PdfAppearance tpl = new PdfAppearance();
        tpl.writer = writer;
        tpl.pdf = pdf;
        tpl.thisReference = thisReference;
        tpl.pageResources = pageResources;
        tpl.bBox = new Rectangle(bBox);
        tpl.group = group;
        tpl.layer = layer;
        if (matrix != null) {
            tpl.matrix = new PdfArray(matrix);
        }
        tpl.separator = separator;
        return tpl;
    }
}

        checkWriter();
        state.size = size;
        if (bf.getFontType() == BaseFont.FONT_TYPE_DOCUMENT) {
            state.fontDetails = new FontDetails(null, ((DocumentFont) bf).getIndirectReference(), bf);
        } else {
            state.fontDetails = writer.addSimple(bf);
        }
        PdfName psn = stdFieldFontNames.get(bf.getPostscriptFontName());
        if (psn == null) {
            if (bf.isSubset() && bf.getFontType() == BaseFont.FONT_TYPE_TTUNI) {
                psn = state.fontDetails.getFontName();
            } else {
                psn = new PdfName(bf.getPostscriptFontName());
                state.fontDetails.setSubset(false);
            }
        }
        PageResources prs = getPageResources();
//        PdfName name = state.fontDetails.getFontName();
        prs.addFont(psn, state.fontDetails.getIndirectReference());
        content.append(psn.getBytes()).append(' ').append(size).append(" Tf").append_i(separator);
    
<methods>public void beginVariableText() ,public static com.lowagie.text.pdf.PdfTemplate createTemplate(com.lowagie.text.pdf.PdfWriter, float, float) ,public void endVariableText() ,public com.lowagie.text.Rectangle getBoundingBox() ,public com.lowagie.text.pdf.PdfContentByte getDuplicate() ,public com.lowagie.text.pdf.PdfTransparencyGroup getGroup() ,public float getHeight() ,public com.lowagie.text.pdf.PdfIndirectReference getIndirectReference() ,public com.lowagie.text.pdf.PdfOCG getLayer() ,public int getType() ,public float getWidth() ,public void setBoundingBox(com.lowagie.text.Rectangle) ,public void setGroup(com.lowagie.text.pdf.PdfTransparencyGroup) ,public void setHeight(float) ,public void setLayer(com.lowagie.text.pdf.PdfOCG) ,public void setMatrix(float, float, float, float, float, float) ,public void setWidth(float) <variables>public static final int TYPE_IMPORTED,public static final int TYPE_PATTERN,public static final int TYPE_TEMPLATE,protected com.lowagie.text.Rectangle bBox,protected com.lowagie.text.pdf.PdfTransparencyGroup group,protected com.lowagie.text.pdf.PdfOCG layer,protected com.lowagie.text.pdf.PdfArray matrix,protected com.lowagie.text.pdf.PageResources pageResources,protected com.lowagie.text.pdf.PdfIndirectReference thisReference,protected int type