/** * Constructor for reading a Type0 font from a PDF file. * * @param fontDictionary The font dictionary according to the PDF specification. * @throws IOException if the descendant font is missing. */ public PDType0Font(COSDictionary fontDictionary) throws IOException { super(fontDictionary); gsubData = GsubData.NO_DATA_FOUND; cmapLookup = null; COSBase base = dict.getDictionaryObject(COSName.DESCENDANT_FONTS); if (!(base instanceof COSArray)) { throw new IOException("Missing descendant font array"); } COSArray descendantFonts = (COSArray) base; if (descendantFonts.size() == 0) { throw new IOException("Descendant font array is empty"); } COSBase descendantFontDictBase = descendantFonts.getObject(0); if (!(descendantFontDictBase instanceof COSDictionary)) { throw new IOException("Missing descendant font dictionary"); } descendantFont = PDFontFactory.createDescendantFont((COSDictionary) descendantFontDictBase, this); readEncoding(); fetchCMapUCS2(); }
/** * Constructor for reading a Type0 font from a PDF file. * * @param fontDictionary The font dictionary according to the PDF specification. * @throws IOException if the descendant font is missing. */ public PDType0Font(COSDictionary fontDictionary) throws IOException { super(fontDictionary); COSBase base = dict.getDictionaryObject(COSName.DESCENDANT_FONTS); if (!(base instanceof COSArray)) { throw new IOException("Missing descendant font array"); } COSArray descendantFonts = (COSArray) base; if (descendantFonts.size() == 0) { throw new IOException("Descendant font array is empty"); } COSBase descendantFontDictBase = descendantFonts.getObject(0); if (!(descendantFontDictBase instanceof COSDictionary)) { throw new IOException("Missing descendant font dictionary"); } descendantFont = PDFontFactory.createDescendantFont((COSDictionary) descendantFontDictBase, this); readEncoding(); fetchCMapUCS2(); }
/** * Constructor for reading a Type0 font from a PDF file. * * @param fontDictionary The font dictionary according to the PDF specification. * @throws IOException if the descendant font is missing. */ public PDType0Font(COSDictionary fontDictionary) throws IOException { super(fontDictionary); COSBase base = dict.getDictionaryObject(COSName.DESCENDANT_FONTS); if (!(base instanceof COSArray)) { throw new IOException("Missing descendant font array"); } COSArray descendantFonts = (COSArray) base; if (descendantFonts.size() == 0) { throw new IOException("Descendant font array is empty"); } COSBase descendantFontDictBase = descendantFonts.getObject(0); if (!(descendantFontDictBase instanceof COSDictionary)) { throw new IOException("Missing descendant font dictionary"); } descendantFont = PDFontFactory.createDescendantFont((COSDictionary) descendantFontDictBase, this); readEncoding(); fetchCMapUCS2(); }