@Override public void subset() throws IOException { if (!willBeSubset()) { throw new IllegalStateException("This font was created with subsetting disabled"); } embedder.subset(); if (ttf != null) { ttf.close(); ttf = null; } }
ttf.close();
/** * Creates a new TrueType font for embedding. */ private PDTrueTypeFont(PDDocument document, TrueTypeFont ttf, Encoding encoding, boolean closeTTF) throws IOException { PDTrueTypeFontEmbedder embedder = new PDTrueTypeFontEmbedder(document, dict, ttf, encoding); this.encoding = encoding; this.ttf = ttf; setFontDescriptor(embedder.getFontDescriptor()); isEmbedded = true; isDamaged = false; glyphList = GlyphList.getAdobeGlyphList(); if (closeTTF) { // the TTF is fully loaded and it is safe to close the underlying data source ttf.close(); } }
ttf.close();
ttf.close();
@Override public void subset() throws IOException { if (!willBeSubset()) { throw new IllegalStateException("This font was created with subsetting disabled"); } embedder.subset(); if (ttf != null) { ttf.close(); ttf = null; } }
@Override public void subset() throws IOException { if (!willBeSubset()) { throw new IllegalStateException("This font was created with subsetting disabled"); } embedder.subset(); if (ttf != null) { ttf.close(); ttf = null; } }
font.close();
/** * Tries to load the original full font from the system */ public PDFont loadOriginal(PDDocument document) { String lookupName = fontName.replace("-", " "); LOG.debug("Searching the system for a font matching name '{}'", lookupName); FontMapping<TrueTypeFont> fontMapping = FontMappers.instance().getTrueTypeFont(lookupName, null); if (fontMapping != null && fontMapping.getFont() != null && !fontMapping.isFallback()) { TrueTypeFont mappedFont = fontMapping.getFont(); try { LOG.debug("Original font available on the system: {}", fontName); return PDType0Font.load(document, mappedFont.getOriginalData()); } catch (IOException ioe) { LOG.warn("Failed to load font from system", ioe); try { mappedFont.close(); } catch (IOException e) { LOG.warn("Failed closing font", e); } } } return null; }
/** * Tries to load the original full font from the system */ public PDFont loadOriginal(PDDocument document) { String lookupName = fontName.replace("-", " "); LOG.debug("Searching the system for a font matching name '{}'", lookupName); FontMapping<TrueTypeFont> fontMapping = FontMappers.instance().getTrueTypeFont(lookupName, null); if (fontMapping != null && fontMapping.getFont() != null && !fontMapping.isFallback()) { TrueTypeFont mappedFont = fontMapping.getFont(); try { LOG.debug("Original font available on the system: {}", fontName); return PDType0Font.load(document, mappedFont.getOriginalData()); } catch (IOException ioe) { LOG.warn("Failed to load font from system", ioe); try { mappedFont.close(); } catch (IOException e) { LOG.warn("Failed closing font", e); } } } return null; }
/** * Creates a new TrueType font for embedding. */ private PDTrueTypeFont(PDDocument document, TrueTypeFont ttf, Encoding encoding, boolean closeTTF) throws IOException { PDTrueTypeFontEmbedder embedder = new PDTrueTypeFontEmbedder(document, dict, ttf, encoding); this.encoding = encoding; this.ttf = ttf; setFontDescriptor(embedder.getFontDescriptor()); isEmbedded = true; isDamaged = false; glyphList = GlyphList.getAdobeGlyphList(); if (closeTTF) { // the TTF is fully loaded and it is safe to close the underlying data source ttf.close(); } }
/** * Private. Creates a new TrueType font for embedding. */ private PDType0Font(PDDocument document, TrueTypeFont ttf, boolean embedSubset, boolean closeOnSubset) throws IOException { embedder = new PDCIDFontType2Embedder(document, dict, ttf, embedSubset, this); descendantFont = embedder.getCIDFont(); readEncoding(); fetchCMapUCS2(); if (closeOnSubset) { if (embedSubset) { this.ttf = ttf; } else { // the TTF is fully loaded and it is save to close the underlying data source ttf.close(); } } }
/** * Creates a new TrueType font for embedding. */ private PDTrueTypeFont(PDDocument document, TrueTypeFont ttf, Encoding encoding, boolean closeTTF) throws IOException { PDTrueTypeFontEmbedder embedder = new PDTrueTypeFontEmbedder(document, dict, ttf, encoding); this.encoding = encoding; this.ttf = ttf; setFontDescriptor(embedder.getFontDescriptor()); isEmbedded = true; isDamaged = false; glyphList = GlyphList.getAdobeGlyphList(); if (closeTTF) { // the TTF is fully loaded and it is save to close the underlying data source ttf.close(); } }
LOG.warn("Failed to load font from system", ioe); try { mappedFont.close(); } catch (Exception e) { LOG.warn("Failed closing font", e);
LOG.warn("Failed to load font from system", ioe); try { mappedFont.close(); } catch (Exception e) { LOG.warn("Failed closing font", e);