public static FontProgram saveFont(FontProgram font, String fontName) { return saveFont(font, FontCacheKey.create(fontName)); }
public static FontProgram saveFont(FontProgram font, String fontName) { return saveFont(font, FontCacheKey.create(fontName)); }
private static FontProgram createType1Font(String metricsPath, String binaryPath, byte[] afm, byte[] pfb, boolean cached) throws java.io.IOException { FontProgram fontProgram; FontCacheKey fontKey = null; if (cached) { fontKey = createFontCacheKey(metricsPath, afm); fontProgram = FontCache.getFont(fontKey); if (fontProgram != null) { return fontProgram; } } fontProgram = new Type1Font(metricsPath, binaryPath, afm, pfb); return cached ? FontCache.saveFont(fontProgram, fontKey) : fontProgram; }
private static FontProgram createType1Font(String metricsPath, String binaryPath, byte[] afm, byte[] pfb, boolean cached) throws java.io.IOException { FontProgram fontProgram; FontCacheKey fontKey = null; if (cached) { fontKey = createFontCacheKey(metricsPath, afm); fontProgram = FontCache.getFont(fontKey); if (fontProgram != null) { return fontProgram; } } fontProgram = new Type1Font(metricsPath, binaryPath, afm, pfb); return cached ? FontCache.saveFont(fontProgram, fontKey) : fontProgram; }
/** * Creates a new TrueType font program from ttc (TrueType Collection) file. * * @param ttc location of TrueType Collection file (*.ttc) * @param ttcIndex the index of the font file from the collection to be read * @param cached true if the font comes from the cache or is added to * the cache if new, false if the font is always created new * @return returns a new {@link FontProgram} instance. This font may come from the cache but only if cached * is true, otherwise it will always be created new */ public static FontProgram createFont(String ttc, int ttcIndex, boolean cached) throws java.io.IOException { FontCacheKey fontCacheKey = FontCacheKey.create(ttc, ttcIndex); if (cached) { FontProgram fontFound = FontCache.getFont(fontCacheKey); if (fontFound != null) { return fontFound; } } FontProgram fontBuilt = new TrueTypeFont(ttc, ttcIndex); return cached ? FontCache.saveFont(fontBuilt, fontCacheKey) : fontBuilt; }
/** * Creates a new TrueType font program from ttc (TrueType Collection) file bytes. * * @param ttc the content of a TrueType Collection file (*.ttc) * @param ttcIndex the index of the font file from the collection to be read * @param cached true if the font comes from the cache or is added to * the cache if new, false if the font is always created new * @return returns a new {@link FontProgram} instance. This font may come from the cache but only if cached * is true, otherwise it will always be created new */ public static FontProgram createFont(byte[] ttc, int ttcIndex, boolean cached) throws java.io.IOException { FontCacheKey fontKey = FontCacheKey.create(ttc, ttcIndex); if (cached) { FontProgram fontFound = FontCache.getFont(fontKey); if (fontFound != null) { return fontFound; } } FontProgram fontBuilt = new TrueTypeFont(ttc, ttcIndex); return cached ? FontCache.saveFont(fontBuilt, fontKey) : fontBuilt; }
/** * Creates a new TrueType font program from ttc (TrueType Collection) file. * * @param ttc location of TrueType Collection file (*.ttc) * @param ttcIndex the index of the font file from the collection to be read * @param cached true if the font comes from the cache or is added to * the cache if new, false if the font is always created new * @return returns a new {@link FontProgram} instance. This font may come from the cache but only if cached * is true, otherwise it will always be created new */ public static FontProgram createFont(String ttc, int ttcIndex, boolean cached) throws java.io.IOException { FontCacheKey fontCacheKey = FontCacheKey.create(ttc, ttcIndex); if (cached) { FontProgram fontFound = FontCache.getFont(fontCacheKey); if (fontFound != null) { return fontFound; } } FontProgram fontBuilt = new TrueTypeFont(ttc, ttcIndex); return cached ? FontCache.saveFont(fontBuilt, fontCacheKey) : fontBuilt; }
/** * Creates a new TrueType font program from ttc (TrueType Collection) file bytes. * * @param ttc the content of a TrueType Collection file (*.ttc) * @param ttcIndex the index of the font file from the collection to be read * @param cached true if the font comes from the cache or is added to * the cache if new, false if the font is always created new * @return returns a new {@link FontProgram} instance. This font may come from the cache but only if cached * is true, otherwise it will always be created new */ public static FontProgram createFont(byte[] ttc, int ttcIndex, boolean cached) throws java.io.IOException { FontCacheKey fontKey = FontCacheKey.create(ttc, ttcIndex); if (cached) { FontProgram fontFound = FontCache.getFont(fontKey); if (fontFound != null) { return fontFound; } } FontProgram fontBuilt = new TrueTypeFont(ttc, ttcIndex); return cached ? FontCache.saveFont(fontBuilt, fontKey) : fontBuilt; }
return cached ? FontCache.saveFont(fontBuilt, fontKey) : fontBuilt;
return cached ? FontCache.saveFont(fontBuilt, fontKey) : fontBuilt;