Package org.apache.fop.fonts

Examples of org.apache.fop.fonts.FontManager$MinimalFontResolver


                LogUtil.handleException(log, e, strict);
            }
        }

        // configure font manager
        FontManager fontManager = factory.getFontManager();
        FontManagerConfigurator fontManagerConfigurator = new FontManagerConfigurator(cfg);
        fontManagerConfigurator.configure(fontManager, strict);

        // configure image loader framework
        configureImageLoading(cfg.getChild("image-loading", false), strict);
View Full Code Here


     */
    protected FopFactory() {
        this.config = new FopFactoryConfigurator(this);
        this.elementMappingRegistry = new ElementMappingRegistry(this);
        this.foURIResolver = new FOURIResolver(validateUserConfigStrictly());
        this.fontManager = new FontManager() {

            /** {@inheritDoc} */
            public void setFontBaseURL(String fontBase) throws MalformedURLException {
                super.setFontBaseURL(getFOURIResolver().checkBaseURL(fontBase));
            }
View Full Code Here

     */
    protected FopFactory() {
        this.config = new FopFactoryConfigurator(this);
        this.elementMappingRegistry = new ElementMappingRegistry(this);
        this.foURIResolver = new FOURIResolver(validateUserConfigStrictly());
        this.fontManager = new FontManager() {

            /** {@inheritDoc} */
            @Override
            public void setFontBaseURL(String fontBase) throws MalformedURLException {
                super.setFontBaseURL(getFOURIResolver().checkBaseURL(fontBase));
View Full Code Here

            throws Exception {
        PrintRenderer renderer = (PrintRenderer) ua.getRendererFactory()
                .createRenderer(ua, MimeConstants.MIME_PDF);
        FontInfo fontInfo = new FontInfo();
        renderer.setupFontInfo(fontInfo);
        FontManager fontManager = ua.getFactory().getFontManager();
        FontCollection[] fontCollections = new FontCollection[] {
                new Base14FontCollection(fontManager.isBase14KerningEnabled()),
                new CustomFontCollection(renderer.getFontResolver(), renderer.getFontList(),
                                         ua.isComplexScriptFeaturesEnabled())
        };
        fontManager.setup(fontInfo, fontCollections);
        FontTriplet triplet = new FontTriplet("Times", "italic",
                Font.WEIGHT_NORMAL);
        String internalFontKey = fontInfo.getInternalFontKey(triplet);
        // Times italic should now be mapped to the 15th font (custom font)
        // not the original base 14 (F6)
View Full Code Here

            log.info("no user configuration file is used [default]");
        }
    }

    private void flushCache() throws FOPException {
        FontManager fontManager = factory.getFontManager();
        File cacheFile = fontManager.getCacheFile();
        if (!fontManager.deleteCache()) {
            System.err.println("Failed to flush the font cache file '"
                    + cacheFile + "'.");
            System.exit(1);
        }
    }
View Full Code Here

     */
    public static FontInfo buildDefaultJava2DBasedFontInfo(
            FontInfo fontInfo, FOUserAgent userAgent) {
        Java2DFontMetrics java2DFontMetrics = new Java2DFontMetrics();

        FontManager fontManager = userAgent.getFactory().getFontManager();
        FontCollection[] fontCollections = new FontCollection[] {
                new org.apache.fop.render.java2d.Base14FontCollection(java2DFontMetrics),
                new InstalledFontCollection(java2DFontMetrics)
        };

        FontInfo fi = (fontInfo != null ? fontInfo : new FontInfo());
        fi.setEventListener(new FontEventAdapter(userAgent.getEventBroadcaster()));
        fontManager.setup(fi, fontCollections);
        return fi;
    }
View Full Code Here

     * @throws FOPException if an error occurs while processing the configuration
     */
    protected List<EmbedFontInfo> buildFontList(Configuration cfg, FontResolver fontResolver,
                    FontEventListener listener) throws FOPException {
        FopFactory factory = userAgent.getFactory();
        FontManager fontManager = factory.getFontManager();
        if (fontResolver == null) {
            //Ensure that we have minimal font resolution capabilities
            fontResolver
                = FontManager.createMinimalFontResolver
                    ( userAgent.isComplexScriptFeaturesEnabled() );
View Full Code Here

    }

    /** {@inheritDoc} */
    public void setupFontInfo(IFDocumentHandler documentHandler, FontInfo fontInfo)
                throws FOPException {
        FontManager fontManager = userAgent.getFactory().getFontManager();
        List<FontCollection> fontCollections = new ArrayList<FontCollection>();
        fontCollections.add(new Base14FontCollection(fontManager.isBase14KerningEnabled()));

        Configuration cfg = super.getRendererConfig(documentHandler.getMimeType());
        if (cfg != null) {
            FontResolver fontResolver = new DefaultFontResolver(userAgent);
            FontEventListener listener = new FontEventAdapter(
                    userAgent.getEventBroadcaster());
            List<EmbedFontInfo> fontList = buildFontList(cfg, fontResolver, listener);
            fontCollections.add(new CustomFontCollection(fontResolver, fontList,
                                userAgent.isComplexScriptFeaturesEnabled()));
        }

        fontManager.setup(fontInfo,
                (FontCollection[])fontCollections.toArray(
                        new FontCollection[fontCollections.size()]));
        documentHandler.setFontInfo(fontInfo);
    }
View Full Code Here

    }

    /** {@inheritDoc} */
    public void setupFontInfo(IFDocumentHandler documentHandler, FontInfo fontInfo)
            throws FOPException {
        final FontManager fontManager = userAgent.getFactory().getFontManager();

        final Java2DFontMetrics java2DFontMetrics = new Java2DFontMetrics();

        final List fontCollections = new java.util.ArrayList();
        fontCollections.add(new Base14FontCollection(java2DFontMetrics));
        fontCollections.add(new InstalledFontCollection(java2DFontMetrics));

        Configuration cfg = super.getRendererConfig(documentHandler.getMimeType());
        if (cfg != null) {
            FontResolver fontResolver = new DefaultFontResolver(userAgent);
            FontEventListener listener = new FontEventAdapter(
                    userAgent.getEventBroadcaster());
            List fontList = buildFontList(cfg, fontResolver, listener);
            fontCollections.add(new ConfiguredFontCollection(fontResolver, fontList,
                                userAgent.isComplexScriptFeaturesEnabled()));
        }

        fontManager.setup(fontInfo,
                (FontCollection[])fontCollections.toArray(
                        new FontCollection[fontCollections.size()]));
        documentHandler.setFontInfo(fontInfo);
    }
View Full Code Here

    }

    /** {@inheritDoc} */
    public void setupFontInfo(IFDocumentHandler documentHandler, FontInfo fontInfo)
                throws FOPException {
        FontManager fontManager = userAgent.getFactory().getFontManager();

        final Java2DFontMetrics java2DFontMetrics = new Java2DFontMetrics();
        final List fontCollections = new java.util.ArrayList();
        fontCollections.add(new Base14FontCollection(java2DFontMetrics));
        fontCollections.add(new InstalledFontCollection(java2DFontMetrics));

        Configuration cfg = super.getRendererConfig(documentHandler.getMimeType());
        if (cfg != null) {
            FontResolver fontResolver = new DefaultFontResolver(userAgent);
            FontEventListener listener = new FontEventAdapter(
                    userAgent.getEventBroadcaster());
            List fontList = buildFontList(cfg, fontResolver, listener);
            fontCollections.add(new ConfiguredFontCollection(fontResolver, fontList,
                                userAgent.isComplexScriptFeaturesEnabled()));
        }

        fontManager.setup(fontInfo,
                (FontCollection[])fontCollections.toArray(
                        new FontCollection[fontCollections.size()]));
        documentHandler.setFontInfo(fontInfo);
    }
View Full Code Here

TOP

Related Classes of org.apache.fop.fonts.FontManager$MinimalFontResolver

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.