/** * This will get the font for this font setting. * * @return The font for this setting of null if one was not found. * * @throws IOException If there is an error getting the font. */ public PDFont getFont() throws IOException { PDFont retval = null; COSBase font = fontSetting.getObject(0); if( font instanceof COSDictionary ) { retval = PDFontFactory.createFont( (COSDictionary)font ); } return retval; }
/** * 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(); }
font = PDFontFactory.createDefaultFont();
font = PDFontFactory.createDefaultFont();
if (dict != null) font = PDFontFactory.createFont(dict);
/** * 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(); }
font = PDFontFactory.createDefaultFont();
/** * Create a default font. * * @return a default font * @throws IOException if something goes wrong */ public static PDFont createDefaultFont() throws IOException { COSDictionary dict = new COSDictionary(); dict.setItem(COSName.TYPE, COSName.FONT); dict.setItem(COSName.SUBTYPE, COSName.TRUE_TYPE); dict.setString(COSName.BASE_FONT, "Arial"); return createFont(dict); } }
/** * 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(); }
try newFont = PDFontFactory.createFont((COSDictionary) font);
/** * This will get the font for this font setting. * * @return The font for this setting of null if one was not found. * * @throws IOException If there is an error getting the font. */ public PDFont getFont() throws IOException { PDFont retval = null; COSBase font = fontSetting.getObject(0); if( font instanceof COSDictionary ) { retval = PDFontFactory.createFont( (COSDictionary)font ); } return retval; }
/** * This will get the font for this font setting. * * @return The font for this setting of null if one was not found. * * @throws IOException If there is an error getting the font. */ public PDFont getFont() throws IOException { PDFont retval = null; COSBase font = fontSetting.getObject(0); if( font instanceof COSDictionary ) { retval = PDFontFactory.createFont( (COSDictionary)font ); } return retval; }
PDFont aFont = PDFontFactory.createFont(xObjFont); FontContainer<?> aContainer = this.context.getFontContainer(aFont.getCOSObject());
try PDFont newFont = PDFontFactory.createFont(fontDict); ContextHelper.validateElement(context, newFont, FONT_PROCESS);
if (dict != null) font = PDFontFactory.createFont(dict);
if (dict != null) font = PDFontFactory.createFont(dict);
/** * Create a default font. * * @return a default font * @throws IOException if something goes wrong */ public static PDFont createDefaultFont() throws IOException { COSDictionary dict = new COSDictionary(); dict.setItem(COSName.TYPE, COSName.FONT); dict.setItem(COSName.SUBTYPE, COSName.TRUE_TYPE); dict.setString(COSName.BASE_FONT, "Arial"); return createFont(dict); } }
/** * Create a default font. * * @return a default font * @throws IOException if something goes wrong */ public static PDFont createDefaultFont() throws IOException { COSDictionary dict = new COSDictionary(); dict.setItem(COSName.TYPE, COSName.FONT); dict.setItem(COSName.SUBTYPE, COSName.TRUE_TYPE); dict.setString(COSName.BASE_FONT, "Arial"); return createFont(dict); } }
try newFont = PDFontFactory.createFont((COSDictionary) font);
try newFont = PDFontFactory.createFont((COSDictionary) font);