Package org.xhtmlrenderer.layout

Examples of org.xhtmlrenderer.layout.SharedContext


    /**
     * Resets all rendered fonts on the current document to the font size
     * specified in the document's styling instructions.
     */
    public void resetFontSize() {
        SharedContext rc = getSharedContext();
        rc.getTextRenderer().setFontScale(1.0F);
        setDocument(getDocument());
    }
View Full Code Here


    /**
     * Applies a change in scale for fonts using the rendering context's text
     * renderer.
     */
    private void scaleFont(float scaleBy) {
        SharedContext rc = getSharedContext();
        float fs = rc.getTextRenderer().getFontScale() * scaleBy;
        if (fs < minFontScale || fs > maxFontScale) return;
        rc.getTextRenderer().setFontScale(fs);
        setDocument(getDocument());
    }
View Full Code Here

        super(parent, checkStyle(style));
        super.setLayout(null);
        setBackground(getDisplay().getSystemColor(SWT.COLOR_WHITE));
        setBackgroundMode(SWT.INHERIT_FORCE);

        _sharedContext = new SharedContext(uac, new SWTFontResolver(parent.getDisplay()),
                new SWTReplacedElementFactory(), new SWTTextRenderer(), getDisplay().getDPI().y);
        _sharedContext.setCanvas(this);

        getHorizontalBar().addListener(SWT.Selection, new Listener() {
            public void handleEvent(Event event) {
View Full Code Here

        this(printer, new NaiveUserAgent(printer));
    }

    public PrinterRenderer(Printer printer, UserAgentCallback uac) {
        _printer = printer;
        _sharedContext = new SharedContext(uac, new SWTFontResolver(printer),
            new SWTReplacedElementFactory(), new SWTTextRenderer(), printer
                .getDPI().y);
        _sharedContext.setPrint(true);
        _sharedContext.setInteractive(false);
    }
View Full Code Here

                    for (int i = 0; i < arr.length; i++) {
                        log.fine("arr[" + i + "]= " + arr[0].getName());
                    }

                    Doc sdoc = new SimpleDoc(this, flavor, null);
                    SharedContext ctx = new SharedContext(uac);
                    ctx.setBaseURL(base);

                    // print the doc as specified
                    job.print(sdoc, attrs);

                } else {
View Full Code Here

        try {
            if (j2dr == null) {

                j2dr = new Java2DRenderer(file, 1024);
                SharedContext context = j2dr.getSharedContext();
                context.setPrint(true);
                context.setInteractive(false);
                context.setDPI(72f);

                context.getTextRenderer().setSmoothingThreshold(0);

            }

            return Printable.PAGE_EXISTS;
        } catch (Exception ex) {
View Full Code Here

            }
        });
    }

    private void setAntiAlias(XHTMLPanel introPanel) {
        SharedContext sharedContext = introPanel.getSharedContext();
        sharedContext.setTextRenderer(new Java2DTextRenderer());
    }
View Full Code Here

        _dotsPerPoint = dotsPerPoint;

        _outputDevice = new ITextOutputDevice(_dotsPerPoint);

        ITextUserAgent userAgent = new ITextUserAgent(_outputDevice);
        _sharedContext = new SharedContext();
        _sharedContext.setUserAgentCallback(userAgent);
        _sharedContext.setCss(new StyleReference(userAgent));
        userAgent.setSharedContext(_sharedContext);
        _outputDevice.setSharedContext(_sharedContext);
View Full Code Here

        _dotsPerPoint = dotsPerPoint;

        _outputDevice = new ITextOutputDevice(_dotsPerPoint);

        ITextUserAgent userAgent = new ITextUserAgent(_outputDevice);
        _sharedContext = new SharedContext();
        _sharedContext.setUserAgentCallback(userAgent);
        _sharedContext.setCss(new StyleReference(userAgent));
        userAgent.setSharedContext(_sharedContext);
        _outputDevice.setSharedContext(_sharedContext);
View Full Code Here

     
      ITextOutputDevice outputDevice = getOutputDevice();
     
      ReplacedElementFactory replacedElementFactory = new ExtendedITextReplacedElementFactory(outputDevice);
     
      SharedContext sharedContext = getSharedContext();
     
      sharedContext.setReplacedElementFactory(replacedElementFactory);
    }
View Full Code Here

TOP

Related Classes of org.xhtmlrenderer.layout.SharedContext

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.