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

            } 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 = getFormForImage(uri);  
                Rectangle2D targetRect = new Rectangle2D.Double(ptx, pty, ptw, pth);
                PSImageUtils.paintForm(form, info.getSize().getDimensionPt(), targetRect, gen);  
            }

        } catch (ImageException ie) {
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

     * 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

                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 if (PSResource.TYPE_FORM.equals(name)) {
            String formname = (String)iter.next();
            this.resource = new PSResource(name, formname);
        } else if (PSResource.TYPE_PATTERN.equals(name)) {
            String patternname = (String)iter.next();
            this.resource = new PSResource(name, patternname);
        } else if (PSResource.TYPE_ENCODING.equals(name)) {
            String encodingname = (String)iter.next();
            this.resource = new PSResource(name, encodingname);
        } else {
            throw new IllegalArgumentException("Invalid resource type: " + name);
        }
    }
View Full Code Here

    /** {@inheritDoc} */
    public void parseValue(String value) {
        List params = splitParams(value);
        Iterator iter = params.iterator();
        String name = (String)iter.next();
        this.resource = new PSResource(PSResource.TYPE_FILE, name);
        if (iter.hasNext()) {
            this.version = new Float(iter.next().toString());
            this.type = null;
            if (iter.hasNext()) {
                this.type = (String)iter.next();
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.