/** * Get a TT font from a collection. * * @param name The postscript name of the font. * @return The found font, nor null if none is found. * @throws IOException */ public TrueTypeFont getFontByName(String name) throws IOException { for (int i = 0; i < numFonts; i++) { TrueTypeFont font = getFontAtIndex(i); if (font.getName().equals(name)) { return font; } } return null; }
if (ttf.getName() != null && ttf.getName().contains("|")) LOG.warn("Skipping font with '|' in name " + ttf.getName() + " in file " + file); else if (ttf.getName() != null) fontInfoList.add(new FSIgnored(file, FontFormat.TTF, ttf.getName())); return; ros = new CIDSystemInfo(registry, ordering, supplement); fontInfoList.add(new FSFontInfo(file, FontFormat.OTF, ttf.getName(), ros, usWeightClass, sFamilyClass, ulCodePageRange1, ulCodePageRange2, macStyle, panose, this)); fontInfoList.add(new FSFontInfo(file, FontFormat.TTF, ttf.getName(), ros, usWeightClass, sFamilyClass, ulCodePageRange1, ulCodePageRange2, macStyle, panose, this));
throw new IOException("The TrueType font " + getName() + " does not contain a 'cmap' table");
LOG.debug("No PostScript name information is provided for the font " + font.getName());
private TrueTypeFont findFontOrSubstitute() throws IOException { TrueTypeFont ttfFont; CIDFontMapping mapping = FontMappers.instance() .getCIDFont(getBaseFont(), getFontDescriptor(), getCIDSystemInfo()); if (mapping.isCIDFont()) { ttfFont = mapping.getFont(); } else { ttfFont = (TrueTypeFont)mapping.getTrueTypeFont(); } if (mapping.isFallback()) { LOG.warn("Using fallback font " + ttfFont.getName() + " for CID-keyed TrueType font " + getBaseFont()); } return ttfFont; }
/** * Creates a new TrueType font for embedding. */ TrueTypeEmbedder(PDDocument document, COSDictionary dict, TrueTypeFont ttf, boolean embedSubset) throws IOException { this.document = document; this.embedSubset = embedSubset; this.ttf = ttf; fontDescriptor = createFontDescriptor(ttf); if (!isEmbeddingPermitted(ttf)) { throw new IOException("This font does not permit embedding"); } if (!embedSubset) { // full embedding PDStream stream = new PDStream(document, ttf.getOriginalData(), COSName.FLATE_DECODE); stream.getCOSObject().setLong(COSName.LENGTH1, ttf.getOriginalDataSize()); fontDescriptor.setFontFile2(stream); } dict.setName(COSName.BASE_FONT, ttf.getName()); // choose a Unicode "cmap" cmap = ttf.getUnicodeCmap(); cmapLookup = ttf.getUnicodeCmapLookup(); }
/** * Get a TT font from a collection. * * @param name The postscript name of the font. * @return The found font, nor null if none is found. * @throws IOException */ public TrueTypeFont getFontByName(String name) throws IOException { for (int i = 0; i < numFonts; i++) { TrueTypeFont font = getFontAtIndex(i); if (font.getName().equals(name)) { return font; } } return null; }
/** * Get a TT font from a collection. * * @param name The postscript name of the font. * @return The found font, nor null if none is found. * @throws IOException */ public TrueTypeFont getFontByName(String name) throws IOException { for (int i = 0; i < numFonts; i++) { TrueTypeFont font = getFontAtIndex(i); if (font.getName().equals(name)) { return font; } } return null; }
fd.setFontName(ttf.getName());
if (ttf.getName() != null && ttf.getName().contains("|")) LOG.warn("Skipping font with '|' in name " + ttf.getName() + " in file " + file); else if (ttf.getName() != null) fontInfoList.add(new FSIgnored(file, FontFormat.TTF, ttf.getName())); return; ros = new CIDSystemInfo(registry, ordering, supplement); fontInfoList.add(new FSFontInfo(file, FontFormat.OTF, ttf.getName(), ros, usWeightClass, sFamilyClass, ulCodePageRange1, ulCodePageRange2, macStyle, panose, this)); fontInfoList.add(new FSFontInfo(file, FontFormat.TTF, ttf.getName(), ros, usWeightClass, sFamilyClass, ulCodePageRange1, ulCodePageRange2, macStyle, panose, this));
LOG.debug("Fallback font available on the system: {} (for {})", mappedFont.getName(), fontName); } else { LOG.debug("Original font available on the system: {}", fontName);
LOG.debug("Fallback font available on the system: {} (for {})", mappedFont.getName(), fontName); } else { LOG.debug("Original font available on the system: {}", fontName);
throw new IOException("The TrueType font " + getName() + " does not contain a 'cmap' table");
throw new IOException("The TrueType font " + getName() + " does not contain a 'cmap' table");
private TrueTypeFont findFontOrSubstitute() throws IOException { TrueTypeFont ttfFont; CIDFontMapping mapping = FontMappers.instance() .getCIDFont(getBaseFont(), getFontDescriptor(), getCIDSystemInfo()); if (mapping.isCIDFont()) { ttfFont = mapping.getFont(); } else { ttfFont = (TrueTypeFont)mapping.getTrueTypeFont(); } if (mapping.isFallback()) { LOG.warn("Using fallback font " + ttfFont.getName() + " for CID-keyed TrueType font " + getBaseFont()); } return ttfFont; }
private TrueTypeFont findFontOrSubstitute() throws IOException { TrueTypeFont ttfFont; CIDFontMapping mapping = FontMappers.instance() .getCIDFont(getBaseFont(), getFontDescriptor(), getCIDSystemInfo()); if (mapping.isCIDFont()) { ttfFont = mapping.getFont(); } else { ttfFont = (TrueTypeFont)mapping.getTrueTypeFont(); } if (mapping.isFallback()) { LOG.warn("Using fallback font " + ttfFont.getName() + " for CID-keyed TrueType font " + getBaseFont()); } return ttfFont; }
/** * Creates a new TrueType font for embedding. */ TrueTypeEmbedder(PDDocument document, COSDictionary dict, TrueTypeFont ttf, boolean embedSubset) throws IOException { this.document = document; this.embedSubset = embedSubset; this.ttf = ttf; fontDescriptor = createFontDescriptor(ttf); if (!isEmbeddingPermitted(ttf)) { throw new IOException("This font does not permit embedding"); } if (!embedSubset) { // full embedding PDStream stream = new PDStream(document, ttf.getOriginalData(), COSName.FLATE_DECODE); stream.getCOSObject().setLong(COSName.LENGTH1, ttf.getOriginalDataSize()); fontDescriptor.setFontFile2(stream); } dict.setName(COSName.BASE_FONT, ttf.getName()); // choose a Unicode "cmap" cmap = ttf.getUnicodeCmap(); cmapLookup = ttf.getUnicodeCmapLookup(); }
/** * Creates a new TrueType font for embedding. */ TrueTypeEmbedder(PDDocument document, COSDictionary dict, TrueTypeFont ttf, boolean embedSubset) throws IOException { this.document = document; this.embedSubset = embedSubset; this.ttf = ttf; fontDescriptor = createFontDescriptor(ttf); if (!isEmbeddingPermitted(ttf)) { throw new IOException("This font does not permit embedding"); } if (!embedSubset) { // full embedding PDStream stream = new PDStream(document, ttf.getOriginalData(), COSName.FLATE_DECODE); stream.getCOSObject().setLong(COSName.LENGTH1, ttf.getOriginalDataSize()); fontDescriptor.setFontFile2(stream); } dict.setName(COSName.BASE_FONT, ttf.getName()); // choose a Unicode "cmap" cmap = ttf.getUnicodeCmap(); }
LOG.debug("No PostScript name information is provided for the font " + font.getName());
fd.setFontName(ttf.getName());