public void addFont(String path, String encoding, boolean embedded) throws DocumentException, IOException { addFont(path, encoding, embedded, null); }
private static Map createInitialFontMap() { HashMap result = new HashMap(); try { addCourier(result); addTimes(result); addHelvetica(result); addSymbol(result); addZapfDingbats(result); // Try and load the iTextAsian fonts if(ITextFontResolver.class.getClassLoader().getResource("com/lowagie/text/pdf/fonts/cjkfonts.properties") != null) { addCJKFonts(result); } } catch (DocumentException e) { throw new RuntimeException(e.getMessage(), e); } catch (IOException e) { throw new RuntimeException(e.getMessage(), e); } return result; }
private FSFont resolveFont(SharedContext ctx, String fontFamily, float size, IdentValue weight, IdentValue style, IdentValue variant) { String normalizedFontFamily = normalizeFontFamily(fontFamily); String cacheKey = getHashName(normalizedFontFamily, weight, style); FontDescription result = (FontDescription)_fontCache.get(cacheKey); if (result != null) { return new ITextFSFont(result, size); } FontFamily family = (FontFamily)_fontFamilies.get(normalizedFontFamily); if (family != null) { result = family.match(convertWeightToInt(weight), style); if (result != null) { _fontCache.put(cacheKey, result); return new ITextFSFont(result, size); } } return null; }
private static Map createInitialFontMap() { HashMap result = new HashMap(); try { addCourier(result); addTimes(result); addHelvetica(result); } catch (DocumentException e) { throw new RuntimeException(e.getMessage(), e); } catch (IOException e) { throw new RuntimeException(e.getMessage(), e); } return result; }
FontFamily fontFamily = getFontFamily(fontFamilyName); String[] names = BaseFont.enumerateTTCNames(path); for (int i = 0; i < names.length; i++) { addFont(path + "," + i, encoding, embedded); path, encoding, embedded, false, null, readFile(pathToPFB)); FontFamily fontFamily = getFontFamily(fontFamilyName);
private static BaseFont createFont(String name) throws DocumentException, IOException { return ITextFontResolver.createFont(name, "winansi", true); }
public void setDocument(Document doc, String url, NamespaceHandler nsh) { _doc = doc; getFontResolver().flushFontFaceFonts(); _sharedContext.reset(); if (Configuration.isTrue("xr.cache.stylesheets", true)) { _sharedContext.getCss().flushStyleSheets(); } else { _sharedContext.getCss().flushAllStyleSheets(); } _sharedContext.setBaseURL(url); _sharedContext.setNamespaceHandler(nsh); _sharedContext.getCss().setDocumentContext(_sharedContext, _sharedContext.getNamespaceHandler(), doc, new NullUserInterface()); getFontResolver().importFontFaces(_sharedContext.getCss().getFontFaceRules()); }
throws DocumentException, IOException { String lower = uri.toLowerCase(); if (fontSupported(lower)) { String fontName = (FontUtil.isEmbeddedBase64Font(uri)) ? fontFamilyNameOverride+SupportedEmbeddedFontTypes.getExtension(uri) : uri; BaseFont font = BaseFont.createFont(fontName, encoding, embedded, false, afmttf, pfb); FontFamily fontFamily = getFontFamily(fontFamilyNames[i]); descr.setWeight(convertWeightToInt(fontWeightOverride)); FontFamily fontFamily = getFontFamily(fontFamilyName);
FontFamily fontFamily = getFontFamily(fontFamilyNames[i]); descr.setWeight(convertWeightToInt(fontWeightOverride)); FontFamily fontFamily = getFontFamily(fontFamilyName);
public void flushCache() { _fontFamilies = createInitialFontMap(); _fontCache = new HashMap(); }
public ITextRenderer(float dotsPerPoint, int dotsPerPixel) { _dotsPerPoint = dotsPerPoint; _outputDevice = new ITextOutputDevice(_dotsPerPoint); ITextUserAgent userAgent = new ITextUserAgent(_outputDevice); _sharedContext = new SharedContext(userAgent); userAgent.setSharedContext(_sharedContext); _outputDevice.setSharedContext(_sharedContext); ITextFontResolver fontResolver = new ITextFontResolver(_sharedContext); _sharedContext.setFontResolver(fontResolver); ITextReplacedElementFactory replacedElementFactory = new ITextReplacedElementFactory(_outputDevice); _sharedContext.setReplacedElementFactory(replacedElementFactory); _sharedContext.setTextRenderer(new ITextTextRenderer()); _sharedContext.setDPI(72*_dotsPerPoint); _sharedContext.setDotsPerPixel(dotsPerPixel); _sharedContext.setPrint(true); _sharedContext.setInteractive(false); }
addFontFaceFont(src.asString(), encoding, embedded, font1, font2); } catch (DocumentException e) { XRLog.exception("Could not load font " + src.asString(), e);
FontSpecification fontSpec = getFontSpecification(); if (fontSpec != null) { int need = ITextFontResolver.convertWeightToInt(fontSpec.fontWeight); int have = desc.getWeight();
FontFamily fontFamily = getFontFamily(fontFamilyName); String[] names = BaseFont.enumerateTTCNames(path); for (int i = 0; i < names.length; i++) { addFont(path + "," + i, fontFamilyNameOverride, encoding, embedded, null); path, encoding, embedded, false, null, readFile(pathToPFB)); FontFamily fontFamily = getFontFamily(fontFamilyName);
private static BaseFont createFont(String name) throws DocumentException, IOException { return ITextFontResolver.createFont(name, "winansi", true); }
public void setDocument(Document doc, String url, NamespaceHandler nsh) { _doc = doc; getFontResolver().flushFontFaceFonts(); _sharedContext.reset(); if (Configuration.isTrue("xr.cache.stylesheets", true)) { _sharedContext.getCss().flushStyleSheets(); } else { _sharedContext.getCss().flushAllStyleSheets(); } _sharedContext.setBaseURL(url); _sharedContext.setNamespaceHandler(nsh); _sharedContext.getCss().setDocumentContext(_sharedContext, _sharedContext.getNamespaceHandler(), doc, new NullUserInterface()); getFontResolver().importFontFaces(_sharedContext.getCss().getFontFaceRules()); }
private static Map createInitialFontMap() { HashMap result = new HashMap(); try { addCourier(result); addTimes(result); addHelvetica(result); } catch (DocumentException e) { throw new RuntimeException(e.getMessage(), e); } catch (IOException e) { throw new RuntimeException(e.getMessage(), e); } return result; }
throws DocumentException, IOException { String lower = uri.toLowerCase(); if (fontSupported(lower)) { String fontName = (FontUtil.isEmbeddedBase64Font(uri)) ? fontFamilyNameOverride+SupportedEmbeddedFontTypes.getExtension(uri) : uri; BaseFont font = BaseFont.createFont(fontName, encoding, embedded, false, afmttf, pfb); FontFamily fontFamily = getFontFamily(fontFamilyNames[i]); descr.setWeight(convertWeightToInt(fontWeightOverride)); FontFamily fontFamily = getFontFamily(fontFamilyName);
public void flushCache() { _fontFamilies = createInitialFontMap(); _fontCache = new HashMap(); }
public ITextRenderer(float dotsPerPoint, int dotsPerPixel, ITextOutputDevice outputDevice, ITextUserAgent userAgent) { _dotsPerPoint = dotsPerPoint; _outputDevice = outputDevice; _sharedContext = new SharedContext(); _sharedContext.setUserAgentCallback(userAgent); _sharedContext.setCss(new StyleReference(userAgent)); userAgent.setSharedContext(_sharedContext); _outputDevice.setSharedContext(_sharedContext); ITextFontResolver fontResolver = new ITextFontResolver(_sharedContext); _sharedContext.setFontResolver(fontResolver); ITextReplacedElementFactory replacedElementFactory = new ITextReplacedElementFactory(_outputDevice); _sharedContext.setReplacedElementFactory(replacedElementFactory); _sharedContext.setTextRenderer(new ITextTextRenderer()); _sharedContext.setDPI(72 * _dotsPerPoint); _sharedContext.setDotsPerPixel(dotsPerPixel); _sharedContext.setPrint(true); _sharedContext.setInteractive(false); _timeouted= false; }