/** * Adds a <CODE>BaseFont</CODE> to the document but not to the page resources. * It is used for templates. * @param bf the <CODE>BaseFont</CODE> to add * @return an <CODE>Object[]</CODE> where position 0 is a <CODE>PdfName</CODE> * and position 1 is an <CODE>PdfIndirectReference</CODE> */ FontDetails addSimple(final BaseFont bf) { FontDetails ret = documentFonts.get(bf); if (ret == null) { PdfWriter.checkPdfIsoConformance(this, PdfIsoKeys.PDFISOKEY_FONT, bf); if (bf.getFontType() == BaseFont.FONT_TYPE_DOCUMENT) { ret = new FontDetails(new PdfName("F" + fontNumber++), ((DocumentFont)bf).getIndirectReference(), bf); } else { ret = new FontDetails(new PdfName("F" + fontNumber++), body.getPdfIndirectReference(), bf); } documentFonts.put(bf, ret); } return ret; }
/** * Adds a <CODE>BaseFont</CODE> to the document but not to the page resources. * It is used for templates. * @param bf the <CODE>BaseFont</CODE> to add * @return an <CODE>Object[]</CODE> where position 0 is a <CODE>PdfName</CODE> * and position 1 is an <CODE>PdfIndirectReference</CODE> */ FontDetails addSimple(final BaseFont bf) { FontDetails ret = documentFonts.get(bf); if (ret == null) { PdfWriter.checkPdfIsoConformance(this, PdfIsoKeys.PDFISOKEY_FONT, bf); if (bf.getFontType() == BaseFont.FONT_TYPE_DOCUMENT) { ret = new FontDetails(new PdfName("F" + fontNumber++), ((DocumentFont)bf).getIndirectReference(), bf); } else { ret = new FontDetails(new PdfName("F" + fontNumber++), body.getPdfIndirectReference(), bf); } documentFonts.put(bf, ret); } return ret; }
/** * Set the font and the size for the subsequent text writing. * * @param bf the font * @param size the font size in points */ @Override public void setFontAndSize(BaseFont bf, float size) { 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); }
/** * Set the font and the size for the subsequent text writing. * * @param bf the font * @param size the font size in points */ @Override public void setFontAndSize(BaseFont bf, float size) { 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); }
FontDetails fd; if (bf.getFontType() == BaseFont.FONT_TYPE_DOCUMENT) { fd = new FontDetails(null, ((DocumentFont)bf).getIndirectReference(), bf);
FontDetails fd; if (bf.getFontType() == BaseFont.FONT_TYPE_DOCUMENT) { fd = new FontDetails(null, ((DocumentFont)bf).getIndirectReference(), bf);