Package org.apache.xmlgraphics.ps

Examples of org.apache.xmlgraphics.ps.PSResource


     * @throws IOException In case of an I/O problem
     */
    public static PSResource defineDerivedFont
        (PSGenerator gen, String baseFontName, String fontName, String encoding)
        throws IOException {
        PSResource res = new PSResource(PSResource.TYPE_FONT, fontName);
        gen.writeDSCComment(DSCConstants.BEGIN_RESOURCE, res);
        gen.commentln("%XGCDependencies: font " + baseFontName);
        gen.commentln("%XGC+ encoding " + encoding);
        gen.writeln("/" + baseFontName + " findfont");
        gen.writeln("dup length dict begin");
View Full Code Here


    private static PSResource defineDerivedTrueTypeFont(PSGenerator gen,
            PSEventProducer eventProducer, String baseFontName, String fontName,
            SingleByteEncoding encoding, CMapSegment[] cmap) throws IOException {
        checkPostScriptLevel3(gen, eventProducer);
        PSResource res = new PSResource(PSResource.TYPE_FONT, fontName);
        gen.writeDSCComment(DSCConstants.BEGIN_RESOURCE, res);
        gen.commentln("%XGCDependencies: font " + baseFontName);
        gen.commentln("%XGC+ encoding " + encoding.getName());
        gen.writeln("/" + baseFontName + " findfont");
        gen.writeln("dup length dict begin");
View Full Code Here

        } else {
            if (log.isDebugEnabled()) {
                log.debug("Image " + info + " is embedded as a form later");
            }
            //Don't load image at this time, just put a form placeholder in the stream
            PSResource form = documentHandler.getFormForImage(info.getOriginalURI());
            PSImageUtils.drawForm(form, info, rect, getGenerator());
        }
    }
View Full Code Here

                //This is to avoid an NPE if a malconfigured font is in the configuration but not
                //used in the document. If it were used, we wouldn't get this far.
                String fallbackKey = fontInfo.getInternalFontKey(Font.DEFAULT_FONT);
                tf = (Typeface)fonts.get(fallbackKey);
            }
            PSResource fontRes = new PSResource("font", tf.getFontName());
            fontResources.put(key, fontRes);
            boolean embeddedFont = false;
            if (FontType.TYPE1 == tf.getFontType()) {
                if (tf instanceof CustomFont) {
                    CustomFont cf = (CustomFont)tf;
View Full Code Here

        Map fonts = fontInfo.getUsedFonts();
        Iterator e = fonts.keySet().iterator();
        while (e.hasNext()) {
            String key = (String)e.next();
            //Typeface font = (Typeface)fonts.get(key);
            PSResource res = (PSResource)this.fontResources.get(key);
            boolean supplied = gen.isResourceSupplied(res);
            if (!supplied) {
                gen.notifyResourceUsage(res, true);
            }
        }
View Full Code Here

        Map fonts = fontInfo.getUsedFonts();
        Iterator e = fonts.keySet().iterator();
        while (e.hasNext()) {
            String key = (String)e.next();
            //Typeface font = (Typeface)fonts.get(key);
            PSResource res = (PSResource)this.fontResources.get(key);
            boolean supplied = gen.isResourceSupplied(res);
            if (!supplied) {
                gen.notifyResourceUsage(res, true);
            }
        }
View Full Code Here

                //This is to avoid an NPE if a malconfigured font is in the configuration but not
                //used in the document. If it were used, we wouldn't get this far.
                String fallbackKey = fontInfo.getInternalFontKey(Font.DEFAULT_FONT);
                tf = (Typeface)fonts.get(fallbackKey);
            }
            PSResource fontRes = new PSResource("font", tf.getFontName());
            fontResources.put(key, fontRes);
            boolean embeddedFont = false;
            if (FontType.TYPE1 == tf.getFontType()) {
                if (tf instanceof CustomFont) {
                    CustomFont cf = (CustomFont)tf;
View Full Code Here

            throw new IllegalArgumentException("uri must not be empty or null");
        }
        if (this.formResources == null) {
            this.formResources = new java.util.HashMap();
        }
        PSResource form = (PSResource)this.formResources.get(uri);
        if (form == null) {
            form = new PSImageFormResource(this.formResources.size() + 1, uri);
            this.formResources.put(uri, form);
        }
        return form;
View Full Code Here

        gen.commentln("%FOPBeginFontDict");

        Map fontResources = new HashMap();
        for (String key : fonts.keySet()) {
            Typeface tf = getTypeFace(fontInfo, fonts, key);
            PSResource fontRes = new PSResource(PSResource.TYPE_FONT, tf.getEmbedFontName());
            PSFontResource fontResource = embedFont(gen, tf, fontRes, eventProducer);
            fontResources.put(key, fontResource);

            if (tf instanceof SingleByteFont) {
                SingleByteFont sbf = (SingleByteFont)tf;

                if (encodeAllCharacters) {
                    sbf.encodeAllUnencodedCharacters();
                }

                for (int i = 0, c = sbf.getAdditionalEncodingCount(); i < c; i++) {
                    SingleByteEncoding encoding = sbf.getAdditionalEncoding(i);
                    defineEncoding(gen, encoding);
                    String postFix = "_" + (i + 1);
                    PSResource derivedFontRes;
                    if (tf.getFontType() == FontType.TRUETYPE
                            && sbf.getTrueTypePostScriptVersion() != PostScriptVersion.V2) {
                        derivedFontRes = defineDerivedTrueTypeFont(gen, eventProducer,
                                tf.getEmbedFontName(), tf.getEmbedFontName() + postFix, encoding,
                                sbf.getCMap());
View Full Code Here

                     * First CID-keyed font to be embedded; add
                     * %%IncludeResource: comment for ProcSet CIDInit.
                     */
                    gen.includeProcsetCIDInitResource();
                }
                PSResource cidFontResource = embedType2CIDFont(gen,
                        (MultiByteFont) tf, in);
                fontResource = PSFontResource.createFontResource(fontRes,
                        gen.getProcsetCIDInitResource(), gen.getIdentityHCMapResource(),
                        cidFontResource);
            }
View Full Code Here

TOP

Related Classes of org.apache.xmlgraphics.ps.PSResource

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.