public static FontProgram getFont(String fontName) { return fontCache.get(FontCacheKey.create(fontName)); }
public static FontProgram getFont(String fontName) { return fontCache.get(FontCacheKey.create(fontName)); }
private static FontProgramDescriptor fetchCachedDescriptor(String fontName, byte[] fontProgram) { FontProgram fontFound; FontCacheKey key; if (fontName != null) { key = FontCacheKey.create(fontName); } else { key = FontCacheKey.create(fontProgram); } fontFound = FontCache.getFont(key); return fontFound != null ? fetchDescriptorFromFontProgram(fontFound) : null; }
public static FontProgram saveFont(FontProgram font, String fontName) { return saveFont(font, FontCacheKey.create(fontName)); }
private static FontProgramDescriptor fetchCachedDescriptor(String fontName, byte[] fontProgram) { FontProgram fontFound; FontCacheKey key; if (fontName != null) { key = FontCacheKey.create(fontName); } else { key = FontCacheKey.create(fontProgram); } fontFound = FontCache.getFont(key); return fontFound != null ? fetchDescriptorFromFontProgram(fontFound) : null; }
public static FontProgram saveFont(FontProgram font, String fontName) { return saveFont(font, FontCacheKey.create(fontName)); }
static FontInfo create(String fontName, String encoding, String alias, Range range) { FontCacheKey cacheKey = FontCacheKey.create(fontName); FontProgramDescriptor descriptor = getFontNamesFromCache(cacheKey); if (descriptor == null) { descriptor = FontProgramDescriptorFactory.fetchDescriptor(fontName); putFontNamesToCache(cacheKey, descriptor); } return descriptor != null ? new FontInfo(fontName, null, encoding, descriptor, range, alias) : null; }
/** * 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; }
static FontInfo create(String fontName, String encoding, String alias, Range range) { FontCacheKey cacheKey = FontCacheKey.create(fontName); FontProgramDescriptor descriptor = getFontNamesFromCache(cacheKey); if (descriptor == null) { descriptor = FontProgramDescriptorFactory.fetchDescriptor(fontName); putFontNamesToCache(cacheKey, descriptor); } return descriptor != null ? new FontInfo(fontName, null, encoding, descriptor, range, alias) : null; }
static FontInfo create(byte[] fontProgram, String encoding, String alias, Range range) { FontCacheKey cacheKey = FontCacheKey.create(fontProgram); FontProgramDescriptor descriptor = getFontNamesFromCache(cacheKey); if (descriptor == null) { descriptor = FontProgramDescriptorFactory.fetchDescriptor(fontProgram); putFontNamesToCache(cacheKey, descriptor); } return descriptor != null ? new FontInfo(null, fontProgram, encoding, descriptor, range, alias) : null; }
static FontInfo create(byte[] fontProgram, String encoding, String alias, Range range) { FontCacheKey cacheKey = FontCacheKey.create(fontProgram); FontProgramDescriptor descriptor = getFontNamesFromCache(cacheKey); if (descriptor == null) { descriptor = FontProgramDescriptorFactory.fetchDescriptor(fontProgram); putFontNamesToCache(cacheKey, descriptor); } return descriptor != null ? new FontInfo(null, fontProgram, encoding, descriptor, range, alias) : null; }
/** * 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; }