Examples of AFPEventProducer


Examples of org.apache.fop.afp.AFPEventProducer

        try {
            this.resourceManager.createIncludedResource(formMap.getName(),
                    formMap.getSrc(), accessor,
                    ResourceObject.TYPE_FORMDEF);
        } catch (IOException ioe) {
            AFPEventProducer eventProducer
                = AFPEventProducer.Provider.get(userAgent.getEventBroadcaster());
            eventProducer.resourceEmbeddingError(this, formMap.getName(), ioe);
        }
    }
View Full Code Here

Examples of org.apache.fop.afp.AFPEventProducer

        if (font.isEmbeddable()) {
            CharacterSet charSet = font.getCharacterSet(fontSize);
            try {
                this.resourceManager.embedFont(font, charSet);
            } catch (IOException ioe) {
                AFPEventProducer eventProducer
                    = AFPEventProducer.Provider.get(userAgent.getEventBroadcaster());
                eventProducer.resourceEmbeddingError(this, charSet.getName(), ioe);
            }
        }

        // create text data info
        AFPTextDataInfo textDataInfo = new AFPTextDataInfo();

        int fontReference = fontAttributes.getFontReference();
        textDataInfo.setFontReference(fontReference);

        int x = (currentIPPosition + text.getBorderAndPaddingWidthStart());
        int y = (currentBPPosition + text.getOffset() + text.getBaselineOffset());

        int[] coords = unitConv.mpts2units(new float[] {x, y} );
        textDataInfo.setX(coords[X]);
        textDataInfo.setY(coords[Y]);

        Color color = (Color) text.getTrait(Trait.COLOR);
        textDataInfo.setColor(color);

        int textWordSpaceAdjust = text.getTextWordSpaceAdjust();
        int textLetterSpaceAdjust = text.getTextLetterSpaceAdjust();
        int textWidth = font.getWidth(' ', fontSize) / 1000;
        textWidth = 0; //JM, the above is strange
        int variableSpaceCharacterIncrement
            = textWidth + textWordSpaceAdjust + textLetterSpaceAdjust;

        variableSpaceCharacterIncrement
            = Math.round(unitConv.mpt2units(variableSpaceCharacterIncrement));
        textDataInfo.setVariableSpaceCharacterIncrement(variableSpaceCharacterIncrement);

        int interCharacterAdjustment
            = Math.round(unitConv.mpt2units(textLetterSpaceAdjust));
        textDataInfo.setInterCharacterAdjustment(interCharacterAdjustment);

        CharacterSet charSet = font.getCharacterSet(fontSize);
        String encoding = charSet.getEncoding();
        textDataInfo.setEncoding(encoding);

        String textString = text.getText();
        textDataInfo.setString(textString);

        try {
            dataStream.createText(textDataInfo, textLetterSpaceAdjust, textWordSpaceAdjust, fnt, charSet);
        } catch (UnsupportedEncodingException e) {
            AFPEventProducer eventProducer
                = AFPEventProducer.Provider.get(userAgent.getEventBroadcaster());
            eventProducer.characterSetEncodingError(this, charSet.getName(), encoding);
        }
        // word.getOffset() = only height of text itself
        // currentBlockIPPosition: 0 for beginning of line; nonzero
        // where previous line area failed to take up entire allocated space
View Full Code Here

Examples of org.apache.fop.afp.AFPEventProducer

    }

    /** {@inheritDoc} */
    public int setup(int start, FontInfo fontInfo) {
        int num = 1;
        AFPEventProducer eventProducer = AFPEventProducer.Provider.get(eventBroadcaster);
        if (fontInfoList != null && fontInfoList.size() > 0) {
            for (Iterator it = fontInfoList.iterator(); it.hasNext();) {
                AFPFontInfo afpFontInfo = (AFPFontInfo)it.next();
                AFPFont afpFont = afpFontInfo.getAFPFont();
                List/*<FontTriplet>*/ tripletList = afpFontInfo.getFontTriplets();
                for (Iterator it2 = tripletList.iterator(); it2.hasNext();) {
                    FontTriplet triplet = (FontTriplet)it2.next();
                    fontInfo.addFontProperties("F" + num,
                            triplet.getName(), triplet.getStyle(), triplet.getWeight());
                    fontInfo.addMetrics("F" + num, afpFont);
                    num++;
                }
            }
            checkDefaultFontAvailable(fontInfo, eventProducer,
                    Font.STYLE_NORMAL, Font.WEIGHT_NORMAL);
            checkDefaultFontAvailable(fontInfo, eventProducer,
                    Font.STYLE_ITALIC, Font.WEIGHT_NORMAL);
            checkDefaultFontAvailable(fontInfo, eventProducer,
                    Font.STYLE_NORMAL, Font.WEIGHT_BOLD);
            checkDefaultFontAvailable(fontInfo, eventProducer,
                    Font.STYLE_ITALIC, Font.WEIGHT_BOLD);
        } else {
            eventProducer.warnDefaultFontSetup(this);

            // Go with a default base 12 configuration for AFP environments
            FontCollection base12FontCollection = new AFPBase12FontCollection();
            num = base12FontCollection.setup(num, fontInfo);
        }
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.