The relevant specification is
http://www.w3.org/TR/SVG11/coords.html#Units

In SVG 1px is defined to be equal to one user unit, even if the
viewBox, width, and height attributes are such that one user unit does
not get mapped to one physical pixel. Other units are derived from px
based on how many pixels one em, cm, pt, etc. are, but using the
identification of px with user units.

In the example you could use a value of 346px in user coordinates to
get 10pt in screen coordinates.

--- In svg-developers@yahoogroups.com, "dvergnaud" <[EMAIL PROTECTED]> wrote:
>
> Hi everyone,
> 
> I'm having a hard time trying to automatically generate SVG objects
> that look the way I want. I'm translating them from another vector
> format, so I'm not all free about the values (e.g. the viewbox sizes,
> as well as width and height, are set and can't be changed). 
> One thing I still have control over is the stroke-width, and that
> seems to be the one that doesn't reliably work - and I can't really
> make any sense of the specification and what I'm seeing now. Here's a
> short example:
> 
> <svg xmlns="http://www.w3.org/2000/svg";
> xmlns:xlink="http://www.w3.org/1999/xlink"; width="453.55pt"
> height="310.75pt" viewBox="1134 1418 15695 10754">
>   <g  id="_x0000_s1053">
>     <g  id="_x0000_s1059">
>       <svg x="5682" y="5038" width="636" height="484" viewBox="0 0
> 21600 21600" preserveAspectRatio="none" fill="white" stroke="cyan"
> stroke-width="10pt" opacity="1" overflow="visible">
>         <path d="M 10800,0 L 0,10800 10800,21600 21600,10800 z "/>
>       </svg>
>     </g>
>     <g  transform=" translate(12012 0) matrix(-1 0 0 1 0 0) rotate(90
> 6006 5921)" id="_x0000_s1073">
>       <svg x="5606" y="5917" width="800" height="9" viewBox="0 0 21600
> 21600" preserveAspectRatio="none" fill="none" stroke="purple"
> stroke-width="10pt" opacity="1" overflow="visible">
>         <path d="M 0,0 L 0,0 0,21600 21600,21600 M 0,0 "/>
>       </svg>
>     </g>
>     <g  id="_x0000_s1104">
>       <svg x="5224" y="6321" width="1569" height="485" viewBox="0 0
> 21600 21600" preserveAspectRatio="none" fill="white" stroke="red"
> stroke-width="10pt" opacity="1" overflow="visible">
>         <path d="M 0,0 L 0,21600 l 21600,0 L 21600,0 z "/>
>       </svg>
>     </g>
>     <g id="line1">
>       <line x1="0" x2="21600" y1="5038" y2="5038" stroke="green"
> stroke-width="10pt"></line>
>     </g>
>     <g id="line3">
>       <line x1="0" x2="21600" y1="5522" y2="5522" stroke="blue"
> stroke-width="10pt"></line>
>     </g>
>     
>     <g id="line2">
>       <line x1="0" x2="21600" y1="6321" y2="6321" stroke="orange"
> stroke-width="10pt"></line>
>     </g>
>     
>     <g id="line4">
>       <line x1="0" x2="21600" y1="5917" y2="5917" stroke="pink"
> stroke-width="10pt"></line>
>     </g>
>   
>   </g>
> </svg>
> 
> There probably are a few "inelegances" in this code, but as I said
> most of it's automatically generated (I added the horizontal lines
> myself). What I'm really not coping with is, as I said, the
> stroke-width attributes. I was using several kinds of units before
> (px, pt, %), but after I was told that could confuse some user agents
> (and it *did* look weird), I switched everything to "pt". 
> 
> Now if one tries to see this SVG file in a browser (I've tried Firefox
> 2.0 on Windows, Safari 3.1.2 and Firefox 3.0.1 on Mac OS), one will
> only see 4 horizontal lines, and perhaps two *very* thin vertical
> lines at the bottom which correspond to the sides of the red
> rectangle. However, displaying the graphic in Squiggle works nearly
> fine -- all objects can be seen and have the same stroke width, but
> then again switching the widths from 2pt to 10pt didn't really change
> the look that much -- why is that?..
> 
> Is this a known bug in Firefox and Safari? As far as I understood it
> (from here: http://www.w3.org/TR/REC-CSS2/syndata.html#length-units)
> the "pt" unit is supposed to be absolute, so the fact that I'm using a
> very "large" viewBox shouldn't really matter, should it? I tend to
> trust Squiggle more, then again I was surprised that both browsers had
> the same "problem". 
> 
> Does anyone know how I could get this SVG to be usable in standard
> browsers? Setting the stroke-width of the svg objects (not the lines)
> to "500pt" kind of solves the problem, but I'm not really sure why.
> And again, the graphic is generated automatically, so I can't afford
> too many "special cases". 
> 
> Thanks a lot in advance for any help! 
> 
> David
>



------------------------------------

-----
To unsubscribe send a message to: [EMAIL PROTECTED]
-or-
visit http://groups.yahoo.com/group/svg-developers and click "edit my 
membership"
----Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/svg-developers/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/svg-developers/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:[EMAIL PROTECTED] 
    mailto:[EMAIL PROTECTED]

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/

Reply via email to