Examples of FontManager


Examples of org.apache.fop.fonts.FontManager

    }

    /** {@inheritDoc} */
    @Override
    public void setDefaultFontInfo(FontInfo fontInfo) {
        FontManager fontManager = getUserAgent().getFactory().getFontManager();
        FontCollection[] fontCollections = new FontCollection[] {
            new AFPFontCollection(getUserAgent().getEventBroadcaster(), null)
        };

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

Examples of org.apache.fop.fonts.FontManager

    public static FontInfo createFontInfo(Configuration cfg) throws FOPException {
        FontInfo fontInfo = new FontInfo();
        if (cfg != null) {
            FontResolver fontResolver = FontManager.createMinimalFontResolver();
            //TODO The following could be optimized by retaining the FontManager somewhere
            FontManager fontManager = new FontManager();

            //TODO Make use of fontBaseURL, font substitution and referencing configuration
            //Requires a change to the expected configuration layout

            //TODO Wire in the FontEventListener
            final FontEventListener listener = null;
            final boolean strict = false;
            FontInfoConfigurator fontInfoConfigurator
                = new FontInfoConfigurator(cfg, fontManager, fontResolver, listener, strict);
            List/*<EmbedFontInfo>*/ fontInfoList = new java.util.ArrayList/*<EmbedFontInfo>*/();
            fontInfoConfigurator.configure(fontInfoList);

            if (fontManager.useCache()) {
                fontManager.getFontCache().save();
            }
            FontSetup.setup(fontInfo, fontInfoList, fontResolver);
        } else {
            FontSetup.setup(fontInfo);
        }
View Full Code Here

Examples of org.apache.fop.fonts.FontManager

    }

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

        Graphics2D graphics2D = Java2DFontMetrics.createFontMetricsGraphics2D();

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

        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));
        }

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

Examples of org.apache.fop.fonts.FontManager

        this.fontInfo = fontInfo;
    }

    /** {@inheritDoc} */
    public void setDefaultFontInfo(FontInfo fontInfo) {
        FontManager fontManager = getUserAgent().getFactory().getFontManager();
        FontCollection[] fontCollections = new FontCollection[] {
                new Base14FontCollection(fontManager.isBase14KerningEnabled())
        };

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

Examples of org.jnode.awt.font.FontManager

    public void drawString(String str, float x, float y) {
        // we should call "simpleGraphics.drawString(str, (int) x, (int) y);"
        // but since it doesn't handle transform, we have to implement ourself the rendering
        // TODO should we move that code to simpleGraphics implementation ?
        JNodeToolkit tk = (JNodeToolkit) Toolkit.getDefaultToolkit();
        FontManager fm = tk.getFontManager();
        fm.drawText(surface, getClip(), getTransform(), str, getFont(), (int) x, (int) y, getColor());
    }
View Full Code Here

Examples of org.jnode.awt.font.FontManager

    /**
     * @return All fonts
     * @see java.awt.GraphicsEnvironment#getAllFonts()
     */
    public Font[] getAllFonts() {
        final FontManager fm = getFontManager();
        if (fm != null) {
            return fm.getAllFonts();
        } else {
            return new Font[0];
        }
    }
View Full Code Here

Examples of org.jnode.awt.font.FontManager

    /**
     * @see java.awt.Toolkit#getFontMetrics(java.awt.Font)
     */
    public FontMetrics getFontMetrics(Font font) {
        final FontManager fm = getFontManager();
        if (fm != null) {
            return fm.getFontMetrics(font);
        } else {
            return null;
        }
    }
View Full Code Here

Examples of org.jnode.awt.font.FontManager

public class FontManagerTest {

    public static void main(String[] args) {
        // fonts loaded
        Font[] fonts = GraphicsEnvironment.getLocalGraphicsEnvironment().getAllFonts();
        FontManager mgr = getFontManager();

        System.out.println("" + fonts.length + " available font(s)");
        for (int i = 0; i < fonts.length; i++) {
            final Font font = fonts[i];
            System.out.println("name=" + font.getName() +
                " family=" + font.getFamily() + "\n" +
                "\tfontName=" + font.getFontName() +
                " size=" + font.getSize() + "\n" +
                "\tmetrics=" + mgr.getFontMetrics(font));
        }
    }
View Full Code Here

Examples of sun.font.FontManager

        return values;
    }

    private Font2D getFont2D() {
        FontManager fm = FontManagerFactory.getInstance();
        if (fm.usingPerAppContextComposites() &&
            font2DHandle != null &&
            font2DHandle.font2D instanceof CompositeFont &&
            ((CompositeFont)(font2DHandle.font2D)).isStdComposite()) {
            return fm.findFont2D(name, style,
                                          FontManager.LOGICAL_FALLBACK);
        } else if (font2DHandle == null) {
            font2DHandle =
                fm.findFont2D(name, style,
                              FontManager.LOGICAL_FALLBACK).handle;
        }
        /* Do not cache the de-referenced font2D. It must be explicitly
         * de-referenced to pick up a valid font in the event that the
         * original one is marked invalid
View Full Code Here

Examples of sun.font.FontManager

         * always from "Font.createFont()" and shouldn't get this treatment.
         */
        if (created) {
            if (handle.font2D instanceof CompositeFont &&
                handle.font2D.getStyle() != style) {
                FontManager fm = FontManagerFactory.getInstance();
                this.font2DHandle = fm.getNewComposite(null, style, handle);
            } else {
                this.font2DHandle = handle;
            }
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.