Package org.apache.xmlgraphics.ps

Examples of org.apache.xmlgraphics.ps.PSResource


        Map fontResources = new java.util.HashMap();
        Iterator iter = fonts.keySet().iterator();
        while (iter.hasNext()) {
            String key = (String)iter.next();
            Typeface tf = getTypeFace(fontInfo, fonts, key);
            PSResource fontRes = new PSResource("font", tf.getFontName());
            fontResources.put(key, fontRes);
            embedFont(gen, tf, fontRes);
        }
        gen.commentln("%FOPEndFontDict");
        reencodeFonts(gen, fonts);
View Full Code Here


        Map fontResources = new java.util.HashMap();
        Iterator iter = fonts.keySet().iterator();
        while (iter.hasNext()) {
            String key = (String)iter.next();
            Typeface tf = getTypeFace(fontInfo, fonts, key);
            PSResource fontRes = new PSResource("font", tf.getFontName());
            fontResources.put(key, fontRes);
            if (FontType.TYPE1 == tf.getFontType()) {
                if (tf instanceof CustomFont) {
                    CustomFont cf = (CustomFont)tf;
                    if (isEmbeddable(cf)) {
View Full Code Here

                PSImageUtils.renderEPS((EPSImage)fopimage, x, y, w, h, gen);
            } else {
                if (isImageInlined(uri, fopimage)) {
                    PSImageUtils.renderBitmapImage(fopimage, x, y, w, h, gen);
                } else {
                    PSResource form = getFormForImage(uri, fopimage);
                    PSImageUtils.renderForm(fopimage, form, x, y, w, h, gen);
                }
            }
        } catch (IOException ioe) {
            handleIOTrouble(ioe);
View Full Code Here

    protected PSResource getFormForImage(String uri, FopImage fopimage) {
        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

     * Returns the PSResource for the given font key.
     * @param key the font key ("F*")
     * @return the matching PSResource
     */
    protected PSResource getPSResourceForFontKey(String key) {
        PSResource res = null;
        if (this.fontResources != null) {
            res = (PSResource)this.fontResources.get(key);
        } else {
            this.fontResources = new java.util.HashMap();
        }
        if (res == null) {
            res = new PSResource(PSResource.TYPE_FONT, getPostScriptNameForFontKey(key));
            this.fontResources.put(key, res);
        }
        return res;
    }
View Full Code Here

     * @param key key of the font ("F*")
     * @param size font size
     */
    protected void useFont(String key, int size) {
        try {
            PSResource res = getPSResourceForFontKey(key);
            //gen.useFont(key, size / 1000f);
            gen.useFont("/" + res.getName(), size / 1000f);
            gen.getResourceTracker().notifyResourceUsageOnPage(res);
        } catch (IOException ioe) {
            handleIOTrouble(ioe);
        }
    }
View Full Code Here

            usedResources.addAll(pageResources);
        } else {
            if (usedResources != null) {
                Iterator iter = usedResources.iterator();
                while (iter.hasNext()) {
                    PSResource res = (PSResource)iter.next();
                    if (documentSuppliedResources == null
                            || !documentSuppliedResources.contains(res)) {
                        registerNeededResource(res);
                    }
                }
View Full Code Here

                throw new IllegalArgumentException(
                        "<resources> must begin with a resource type. Found: " + name);
            }
            if (PSResource.TYPE_FONT.equals(currentResourceType)) {
                String fontname = (String)iter.next();
                addResource(new PSResource(name, fontname));
            } else if (PSResource.TYPE_FORM.equals(currentResourceType)) {
                String formname = (String)iter.next();
                addResource(new PSResource(name, formname));
            } else if (PSResource.TYPE_PROCSET.equals(currentResourceType)) {
                String procname = (String)iter.next();
                String version = (String)iter.next();
                String revision = (String)iter.next();
                addResource(new PSProcSet(procname,
                        Float.parseFloat(version), Integer.parseInt(revision)));
            } else if (PSResource.TYPE_FILE.equals(currentResourceType)) {
                String filename = (String)iter.next();
                addResource(new PSResource(name, filename));
            } else {
                throw new IllegalArgumentException("Invalid resource type: " + currentResourceType);
            }
        }
    }
View Full Code Here

            if (!first) {
                gen.writeln(sb.toString());
                sb.setLength(0);
                sb.append("%%+ ");
            }
            PSResource res = (PSResource)i.next();
            sb.append(res.getResourceSpecification());
            first = false;
        }
        gen.writeln(sb.toString());
    }
View Full Code Here

        List params = splitParams(value);
        Iterator iter = params.iterator();
        String name = (String)iter.next();
        if (PSResource.TYPE_FONT.equals(name)) {
            String fontname = (String)iter.next();
            this.resource = new PSResource(name, fontname);
        } else if (PSResource.TYPE_PROCSET.equals(name)) {
            String procname = (String)iter.next();
            String version = (String)iter.next();
            String revision = (String)iter.next();
            this.resource = new PSProcSet(procname,
                    Float.parseFloat(version), Integer.parseInt(revision));
        } else if (PSResource.TYPE_FILE.equals(name)) {
            String filename = (String)iter.next();
            this.resource = new PSResource(name, filename);
        } else {
            throw new IllegalArgumentException("Invalid resource type: " + name);
        }
    }
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.