/** * 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; }
/** * Finds a TrueType font with the given PostScript name, or a suitable substitute, or null. * * @param fontDescriptor FontDescriptor */ @Override public FontMapping<TrueTypeFont> getTrueTypeFont(String baseFont, PDFontDescriptor fontDescriptor) { TrueTypeFont ttf = (TrueTypeFont)findFont(FontFormat.TTF, baseFont); if (ttf != null) { return new FontMapping<>(ttf, false); } else { // fallback - todo: i.e. fuzzy match String fontName = getFallbackFontName(fontDescriptor); ttf = (TrueTypeFont) findFont(FontFormat.TTF, fontName); if (ttf == null) { // we have to return something here as TTFs aren't strictly required on the system ttf = lastResortFont; } return new FontMapping<>(ttf, true); } }
/** * 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; }
/** * 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; }
/** * Finds a TrueType font with the given PostScript name, or a suitable substitute, or null. * * @param fontDescriptor FontDescriptor */ @Override public FontMapping<TrueTypeFont> getTrueTypeFont(String baseFont, PDFontDescriptor fontDescriptor) { TrueTypeFont ttf = (TrueTypeFont)findFont(FontFormat.TTF, baseFont); if (ttf != null) { return new FontMapping<TrueTypeFont>(ttf, false); } else { // fallback - todo: i.e. fuzzy match String fontName = getFallbackFontName(fontDescriptor); ttf = (TrueTypeFont) findFont(FontFormat.TTF, fontName); if (ttf == null) { // we have to return something here as TTFs aren't strictly required on the system ttf = lastResortFont; } return new FontMapping<TrueTypeFont>(ttf, true); } }
/** * Finds a TrueType font with the given PostScript name, or a suitable substitute, or null. * * @param fontDescriptor FontDescriptor */ @Override public FontMapping<TrueTypeFont> getTrueTypeFont(String baseFont, PDFontDescriptor fontDescriptor) { TrueTypeFont ttf = (TrueTypeFont)findFont(FontFormat.TTF, baseFont); if (ttf != null) { return new FontMapping<>(ttf, false); } else { // fallback - todo: i.e. fuzzy match String fontName = getFallbackFontName(fontDescriptor); ttf = (TrueTypeFont) findFont(FontFormat.TTF, fontName); if (ttf == null) { // we have to return something here as TTFs aren't strictly required on the system ttf = lastResortFont; } return new FontMapping<>(ttf, true); } }