/** * Gets first empty code, that could use with {@see addSymbol()} * * @return code from 1 to 255 or -1 if all slots are busy. */ private int getFirstEmptyCode() { final int startFrom = 1; for (int i = startFrom; i < 256; i++) { if (!fontEncoding.canDecode(i)) { return i; } } return -1; }
if (fontEncoding.canDecode(k)) { shortTag[k] = 1; } else if (!fontEncoding.hasDifferences() && fontProgram.getGlyphByCode(k) != null) {
@Override public void flush() { if (isFlushed()) return; ensureUnderlyingObjectHasIndirectReference(); if (((Type3Font) getFontProgram()).getNumberOfGlyphs() < 1) { throw new PdfException("No glyphs defined for type3 font."); } PdfDictionary charProcs = new PdfDictionary(); for (int i = 0; i < 256; i++) { if (fontEncoding.canDecode(i)) { Type3Glyph glyph = getType3Glyph(fontEncoding.getUnicode(i)); if (glyph != null) { charProcs.put(new PdfName(fontEncoding.getDifference(i)), glyph.getContentStream()); glyph.getContentStream().flush(); } } } getPdfObject().put(PdfName.CharProcs, charProcs); getPdfObject().put(PdfName.FontMatrix, new PdfArray(getFontMatrix())); getPdfObject().put(PdfName.FontBBox, new PdfArray(fontProgram.getFontMetrics().getBbox())); String fontName = fontProgram.getFontNames().getFontName(); super.flushFontData(fontName, PdfName.Type3); //BaseFont is not listed as key in Type 3 font specification. getPdfObject().remove(PdfName.BaseFont); super.flush(); }