xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thomas.dewe...@kodak.com
Subject Re: units for transform(translate( ))
Date Tue, 08 Apr 2008 15:04:03 GMT
Hi Abraham,

"Abraham Rodriguez Mota" <abraham.rdgz@gmail.com> wrote on 04/07/2008 
01:30:02 PM:

> 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? 

   Well your code is asking for the font-size on the group
but your stylesheet is setting the font size on text elements.
So if you want/need to know the font size on a text element 
then you need to ask the CSS engine for the font size on that 
text element.

Thomas DeWeese | CDG Advanced Development | 
Eastman Kodak Company | 343 State Street | Rochester, NY 14650-0128 | 
Thomas.DeWeese@Kodak.com | 585 781-9059 | 
www.kodak.com 



> 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