@Override protected void checkNonSymbolicTrueTypeFont(PdfTrueTypeFont trueTypeFont) { String encoding = trueTypeFont.getFontEncoding().getBaseEncoding(); // non-symbolic true type font will always has an encoding entry in font dictionary in itext7 if (!PdfEncodings.WINANSI.equals(encoding) && !encoding.equals(PdfEncodings.MACROMAN)) { throw new PdfAConformanceException(PdfAConformanceException.ALL_NON_SYMBOLIC_TRUE_TYPE_FONT_SHALL_SPECIFY_MAC_ROMAN_ENCODING_OR_WIN_ANSI_ENCODING, trueTypeFont); } // if font has differences array, itext7 ensures that all names in it are listed in AdobeGlyphList }
@Override protected void checkNonSymbolicTrueTypeFont(PdfTrueTypeFont trueTypeFont) { String encoding = trueTypeFont.getFontEncoding().getBaseEncoding(); // non-symbolic true type font will always has an encoding entry in font dictionary in itext7 if (!PdfEncodings.WINANSI.equals(encoding) && !encoding.equals(PdfEncodings.MACROMAN)) { throw new PdfAConformanceException(PdfAConformanceException.ALL_NON_SYMBOLIC_TRUE_TYPE_FONT_SHALL_SPECIFY_MAC_ROMAN_ENCODING_OR_WIN_ANSI_ENCODING, trueTypeFont); } // if font has differences array, itext7 ensures that all names in it are listed in AdobeGlyphList }
@Override protected void checkNonSymbolicTrueTypeFont(PdfTrueTypeFont trueTypeFont) { String encoding = trueTypeFont.getFontEncoding().getBaseEncoding(); // non-symbolic true type font will always has an encoding entry in font dictionary in itext7 if (!PdfEncodings.WINANSI.equals(encoding) && !encoding.equals(PdfEncodings.MACROMAN) || trueTypeFont.getFontEncoding().hasDifferences()) { throw new PdfAConformanceException(PdfAConformanceException.ALL_NON_SYMBOLIC_TRUE_TYPE_FONT_SHALL_SPECIFY_MAC_ROMAN_OR_WIN_ANSI_ENCODING_AS_THE_ENCODING_ENTRY, trueTypeFont); } }
@Override protected void checkNonSymbolicTrueTypeFont(PdfTrueTypeFont trueTypeFont) { String encoding = trueTypeFont.getFontEncoding().getBaseEncoding(); // non-symbolic true type font will always has an encoding entry in font dictionary in itext7 if (!PdfEncodings.WINANSI.equals(encoding) && !encoding.equals(PdfEncodings.MACROMAN) || trueTypeFont.getFontEncoding().hasDifferences()) { throw new PdfAConformanceException(PdfAConformanceException.ALL_NON_SYMBOLIC_TRUE_TYPE_FONT_SHALL_SPECIFY_MAC_ROMAN_OR_WIN_ANSI_ENCODING_AS_THE_ENCODING_ENTRY, trueTypeFont); } }
/** * {@inheritDoc} */ @Override public GlyphLine decodeIntoGlyphLine(PdfString content) { byte[] contentBytes = content.getValueBytes(); List<Glyph> glyphs = new ArrayList<>(contentBytes.length); for (byte b : contentBytes) { int code = b & 0xff; Glyph glyph = null; if (toUnicode != null && toUnicode.lookup(code) != null && (glyph = fontProgram.getGlyphByCode(code)) != null) { if (!Arrays.equals(toUnicode.lookup(code), glyph.getChars())) { // Copy the glyph because the original one may be reused (e.g. standard Helvetica font program) glyph = new Glyph(glyph); glyph.setChars(toUnicode.lookup(code)); } } else { int uni = fontEncoding.getUnicode(code); if (uni > -1) { glyph = getGlyph(uni); } else if (fontEncoding.getBaseEncoding() == null) { glyph = fontProgram.getGlyphByCode(code); } } if (glyph != null) { glyphs.add(glyph); } } return new GlyphLine(glyphs); }
getPdfObject().put(PdfName.Encoding, enc); } else if (!fontEncoding.isFontSpecific()) { getPdfObject().put(PdfName.Encoding, PdfEncodings.CP1252.equals(fontEncoding.getBaseEncoding()) ? PdfName.WinAnsiEncoding : PdfName.MacRomanEncoding);