xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Abraham Rodriguez Mota" <abraham.r...@gmail.com>
Subject Re: units for transform(translate( ))
Date Mon, 07 Apr 2008 17:30:02 GMT
Hi Thomas,

I tried to calculate the positions getting the value of the font-size from
the SVG DOM document, but I get a value that is different from the one set
on the style sheet. Any advice on how to get consistent values?
Here are the snippets of the java and CSS code:

        //Cast from DOM to DocumentView
       DocumentView docView=(DocumentView)singleProject.getDocument();
        AbstractView abstractView=docView.getDefaultView();
       //cast from AbstractView to ViewCSS
        ViewCSS viewCSS=(ViewCSS)abstractView;
        //Read font-size from the CurrenBlock element
       //currentBlock is a group <g> containing text elements
        CSSStyleDeclaration
cssDeclaration=viewCSS.getComputedStyle(currentBlock,null);
        System.out.println("font-size");
        System.out.println(cssDeclaration.getPropertyCSSValue("font-size"));
        System.out.println(cssDeclaration.getPropertyValue("font-size"));

The output is:
font-size
org.apache.batik.css.dom.CSSOMComputedStyle$ComputedCSSValue@1ef553d
12

But the CSS is:
text{
font-size:10pt;
}



Thanks in advance

Abraham

On Wed, Apr 2, 2008 at 11:18 AM, <thomas.deweese@kodak.com> wrote:

> Hi Abraham
>
> "Abraham Rodriguez Mota" <abraham.rdgz@gmail.com> wrote on 04/01/2008
> 11:08:10 AM:
>
> > I tried to do the maths, but because I didn't find an exact
> > calculation , after a series of adding and removing tasks big gaps
> > of empty space appears on the boxes. Do you have any advice about it?
>
>     size in 'px' = size in 'em' * font-size.
>     You can get the font-size for an element with the
> getComputedStyle and getPropertyValue methods.
>
>
>
> > On Fri, Mar 14, 2008 at 3:56 AM, Tonny Kohar <tonny.kohar@gmail.com>
> wrote:
> > Hi,
> >
> > On Fri, Mar 14, 2008 at 3:55 AM, Abraham Rodriguez Mota
> > <abraham.rdgz@gmail.com> wrote:
> >
> > Did you try to calculate the equivalent of translate unit to px value ?
> >
> > Cheers
> > Tonny Kohar
> > --
> > Citra FX Photo Effects
> > imagine, design, create ...
> > http://www.kiyut.com
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> > For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
>

Mime
View raw message