use of org.apache.fontbox.type1.Type1Font in project pdfbox by apache.
the class FileSystemFontProvider method addType1Font.
/**
* Adds a Type 1 font to the file cache. To reduce memory, the parsed font is not cached.
*/
private void addType1Font(File pfbFile) throws IOException {
try (InputStream input = new FileInputStream(pfbFile)) {
Type1Font type1 = Type1Font.createWithPFB(input);
if (type1.getName() != null && type1.getName().contains("|")) {
fontInfoList.add(new FSIgnored(pfbFile, FontFormat.PFB, "*skippipeinname*"));
LOG.warn("Skipping font with '|' in name " + type1.getName() + " in file " + pfbFile);
return;
}
fontInfoList.add(new FSFontInfo(pfbFile, FontFormat.PFB, type1.getName(), null, -1, -1, 0, 0, -1, null, this));
if (LOG.isTraceEnabled()) {
LOG.trace("PFB: '" + type1.getName() + "' / '" + type1.getFamilyName() + "' / '" + type1.getWeight() + "'");
}
} catch (IOException e) {
LOG.error("Could not load font file: " + pfbFile, e);
}
}
use of org.apache.fontbox.type1.Type1Font in project pdfbox by apache.
the class FontMapperImpl method findFontBoxFont.
/**
* Finds a font with the given PostScript name, or a suitable substitute, or null.
*
* @param postScriptName PostScript font name
*/
private FontBoxFont findFontBoxFont(String postScriptName) {
Type1Font t1 = (Type1Font) findFont(FontFormat.PFB, postScriptName);
if (t1 != null) {
return t1;
}
TrueTypeFont ttf = (TrueTypeFont) findFont(FontFormat.TTF, postScriptName);
if (ttf != null) {
return ttf;
}
OpenTypeFont otf = (OpenTypeFont) findFont(FontFormat.OTF, postScriptName);
if (otf != null) {
return otf;
}
return null;
}
Aggregations