/** * Creates a new standard Helvetica font program file. * * @return a {@link FontProgram} object with Helvetica font description */ public static FontProgram createFont() throws java.io.IOException { return createFont(StandardFonts.HELVETICA); }
/** * Creates a new standard Helvetica font program file. * * @return a {@link FontProgram} object with Helvetica font description */ public static FontProgram createFont() throws java.io.IOException { return createFont(StandardFonts.HELVETICA); }
/** * Creates a new font program. This font program can be one of the 14 built in fonts, * a Type1 font referred to by an AFM or PFM file, a TrueType font or * a CJK font from the Adobe Asian Font Pack. * Fonts in TrueType Collections are addressed by index such as "msgothic.ttc,1". * This would get the second font (indexes start at 0), in this case "MS PGothic". * <p> * The fonts are cached and if they already exist they are extracted from the cache, * not parsed again. * <p> * * @param fontProgram the name of the font or its location on file * @return returns a new {@link FontProgram}. This font program may come from the cache */ public static FontProgram createFont(String fontProgram) throws java.io.IOException { return createFont(fontProgram, null, DEFAULT_CACHED); }
/** * Creates a new font program. This font program can be one of the 14 built in fonts, * a Type1 font referred to by an AFM or PFM file, a TrueType font or * a CJK font from the Adobe Asian Font Pack. * Fonts in TrueType Collections are addressed by index such as "msgothic.ttc,1". * This would get the second font (indexes start at 0), in this case "MS PGothic". * <p> * The fonts are cached and if they already exist they are extracted from the cache, * not parsed again. * <p> * * @param fontProgram the name of the font or its location on file * @return returns a new {@link FontProgram}. This font program may come from the cache */ public static FontProgram createFont(String fontProgram) throws java.io.IOException { return createFont(fontProgram, null, DEFAULT_CACHED); }
/** * Creates a new font program. This font program can be one of the 14 built in fonts, * a Type1 font referred to by an AFM or PFM file, a TrueType font or * a CJK font from the Adobe Asian Font Pack. * Fonts in TrueType Collections are addressed by index such as "msgothic.ttc,1". * This would get the second font (indexes start at 0), in this case "MS PGothic". * <p> * The fonts are cached and if they already exist they are extracted from the cache, * not parsed again. * <p> * * @param fontProgram the byte contents of the font program * @return returns a new {@link FontProgram}. This font program may come from the cache */ public static FontProgram createFont(byte[] fontProgram) throws java.io.IOException { return createFont(null, fontProgram, DEFAULT_CACHED); }
/** * Creates a new font program. This font program can be one of the 14 built in fonts, * a Type1 font referred to by an AFM or PFM file, a TrueType font or * a CJK font from the Adobe Asian Font Pack. * Fonts in TrueType Collections are addressed by index such as "msgothic.ttc,1". * This would get the second font (indexes start at 0), in this case "MS PGothic". * <p> * The fonts are cached and if they already exist they are extracted from the cache, * not parsed again. * <p> * * @param fontProgram the name of the font or its location on file * @param cached whether to to cache this font program after it has been loaded * @return returns a new {@link FontProgram}. This font program may come from the cache */ public static FontProgram createFont(String fontProgram, boolean cached) throws java.io.IOException { return createFont(fontProgram, null, cached); }
/** * Creates a new font program. This font program can be one of the 14 built in fonts, * a Type1 font referred to by an AFM or PFM file, a TrueType font or * a CJK font from the Adobe Asian Font Pack. * Fonts in TrueType Collections are addressed by index such as "msgothic.ttc,1". * This would get the second font (indexes start at 0), in this case "MS PGothic". * <p> * The fonts are cached and if they already exist they are extracted from the cache, * not parsed again. * <p> * * @param fontProgram the byte contents of the font program * @return returns a new {@link FontProgram}. This font program may come from the cache */ public static FontProgram createFont(byte[] fontProgram) throws java.io.IOException { return createFont(null, fontProgram, DEFAULT_CACHED); }
/** * Creates a new font program. This font program can be one of the 14 built in fonts, * a Type1 font referred to by an AFM or PFM file, a TrueType font or * a CJK font from the Adobe Asian Font Pack. * Fonts in TrueType Collections are addressed by index such as "msgothic.ttc,1". * This would get the second font (indexes start at 0), in this case "MS PGothic". * <p> * The fonts are cached and if they already exist they are extracted from the cache, * not parsed again. * <p> * * @param fontProgram the name of the font or its location on file * @param cached whether to to cache this font program after it has been loaded * @return returns a new {@link FontProgram}. This font program may come from the cache */ public static FontProgram createFont(String fontProgram, boolean cached) throws java.io.IOException { return createFont(fontProgram, null, cached); }
/** * Creates a new font program. This font program can be one of the 14 built in fonts, * a Type 1 font referred to by an AFM or PFM file, a TrueType font or * a CJK font from the Adobe Asian Font Pack. * Fonts in TrueType Collections are addressed by index such as "msgothic.ttc,1". * This would get the second font (indexes start at 0), in this case "MS PGothic". * <p> * The fonts are cached and if they already exist they are extracted from the cache, * not parsed again. * <p> * * @param fontProgram the byte contents of the font program * @param cached whether to to cache this font program * @return returns a new {@link FontProgram}. This font program may come from the cache */ public static FontProgram createFont(byte[] fontProgram, boolean cached) throws java.io.IOException { return createFont(null, fontProgram, cached); }
/** * Creates a new font program. This font program can be one of the 14 built in fonts, * a Type 1 font referred to by an AFM or PFM file, a TrueType font or * a CJK font from the Adobe Asian Font Pack. * Fonts in TrueType Collections are addressed by index such as "msgothic.ttc,1". * This would get the second font (indexes start at 0), in this case "MS PGothic". * <p> * The fonts are cached and if they already exist they are extracted from the cache, * not parsed again. * <p> * * @param fontProgram the byte contents of the font program * @param cached whether to to cache this font program * @return returns a new {@link FontProgram}. This font program may come from the cache */ public static FontProgram createFont(byte[] fontProgram, boolean cached) throws java.io.IOException { return createFont(null, fontProgram, cached); }
protected FontProgram getFontProgram(String fontName, boolean cached) throws java.io.IOException { FontProgram fontProgram = null; fontName = fontNames.get(fontName.toLowerCase()); if (fontName != null) { fontProgram = FontProgramFactory.createFont(fontName, cached); } return fontProgram; }
protected FontProgram getFontProgram(String fontName, boolean cached) throws java.io.IOException { FontProgram fontProgram = null; fontName = fontNames.get(fontName.toLowerCase()); if (fontName != null) { fontProgram = FontProgramFactory.createFont(fontName, cached); } return fontProgram; }
/** * method return TrueTypeFont by ttc index * * @param ttcIndex the index for the TTC font * @return TrueTypeFont */ public FontProgram getFontByTccIndex(int ttcIndex) throws java.io.IOException { if (ttcIndex > TTCSize - 1) { throw new IOException(IOException.TtcIndexDoesNotExistInThisTtcFile); } if (ttcPath != null) { return FontProgramFactory.createFont(ttcPath, ttcIndex, cached); } else { return FontProgramFactory.createFont(ttc, ttcIndex, cached); } }
/** * method return TrueTypeFont by ttc index * * @param ttcIndex the index for the TTC font * @return TrueTypeFont */ public FontProgram getFontByTccIndex(int ttcIndex) throws java.io.IOException { if (ttcIndex > TTCSize - 1) { throw new IOException(IOException.TtcIndexDoesNotExistInThisTtcFile); } if (ttcPath != null) { return FontProgramFactory.createFont(ttcPath, ttcIndex, cached); } else { return FontProgramFactory.createFont(ttc, ttcIndex, cached); } }
/** * Created a {@link PdfFont} instance by the bytes of the underlying font program. * * @param fontProgram the bytes of the underlying font program * @param encoding the encoding of the font to be created. See {@link PdfEncodings} * @param embedded indicates whether the font is to be embedded into the target document * @param cached indicates whether the font will be cached * @return created {@link PdfFont} instance * @throws IOException signals that an I/O exception has occurred. */ public static PdfFont createFont(byte[] fontProgram, String encoding, boolean embedded, boolean cached) throws IOException { FontProgram fp = FontProgramFactory.createFont(fontProgram, cached); return createFont(fp, encoding, embedded); }
/** * Created a {@link PdfFont} instance given the path to the font file. * * @param fontProgram the font program file * @param encoding the encoding of the font to be created. See {@link PdfEncodings} * @param embedded indicates whether the font is to be embedded into the target document * @param cached indicates whether the font will be cached * @return created {@link PdfFont} instance * @throws IOException in case the file is not found or the contents of the font file is mal-formed */ public static PdfFont createFont(String fontProgram, String encoding, boolean embedded, boolean cached) throws IOException { FontProgram fp = FontProgramFactory.createFont(fontProgram, cached); return createFont(fp, encoding, embedded); }
/** * Creates a {@link PdfFont} instance from the TrueType Collection represented by its byte contents. * * @param ttc the byte contents of the TrueType Collection * @param ttcIndex the index of the font in the collection, zero-based * @param encoding the encoding of the font to be created. See {@link PdfEncodings} * @param embedded indicates whether the font is to be embedded into the target document * @param cached indicates whether the font will be cached * @return created {@link PdfFont} instance * @throws IOException in case the contents of the TrueType Collection is mal-formed or an error occurred during reading the font */ public static PdfFont createTtcFont(byte[] ttc, int ttcIndex, String encoding, boolean embedded, boolean cached) throws IOException { FontProgram fontProgram = FontProgramFactory.createFont(ttc, ttcIndex, cached); return createFont(fontProgram, encoding, embedded); }
/** * Creates a {@link PdfFont} instance from the TrueType Collection given by the path to the .ttc file. * * @param ttc the path of the .ttc file * @param ttcIndex the index of the font in the collection, zero-based * @param encoding the encoding of the font to be created. See {@link PdfEncodings} * @param embedded indicates whether the font is to be embedded into the target document * @param cached indicates whether the font will be cached * @return created {@link PdfFont} instance * @throws IOException in case the file is not found, contents of the TrueType Collection is mal-formed * or an error occurred during reading the font */ public static PdfFont createTtcFont(String ttc, int ttcIndex, String encoding, boolean embedded, boolean cached) throws IOException { FontProgram fontProgram = FontProgramFactory.createFont(ttc, ttcIndex, cached); return createFont(fontProgram, encoding, embedded); }
if (fontProgram == null) { if (fontInfo.getFontData() != null) { fontProgram = FontProgramFactory.createFont(fontInfo.getFontData(), getDefaultCacheFlag()); } else { fontProgram = FontProgramFactory.createFont(fontInfo.getFontName(), getDefaultCacheFlag());
FontProgram fp = FontProgramFactory.createFont(bytes, false); context.addTemporaryFont(fp, PdfEncodings.IDENTITY_H, fontFamily); return true;