On Sat, 2003-12-13 at 05:10, Lauris Kaplinski wrote:
> > (this is why all examples in the SVG spec specify a viewBox)
> >=20
> > Thinking about this, if Sodipodi intends to be completely interoperable=
,
> > it needs to always write a default viewBox according to the base
> > units/points mapping it imposes.
> >=20
> > e.g. for a document 100ptx100pt, the viewBox should be "0 0 125 125".
>=20
> Are you saying, that 'width' and 'height' attributes of outermost
> SVG have different semantics, as the same attributes in inner elements?
> AFAIK it is not the case, so viewBoxonly changes the meaning of:
> A) Percentages (as these are not defined as % of viewbox)
> B) Base units by ratio of width/viewBox_width and height/viewBox_height
> - but as width and height are in relative units, this is no
> different that applying 'transform'.
Consider these two SVG documents (I'll leave out namespace/XML
declarations and other boilerplate for brevity):
<svg width=3D"100pt" height=3D"100pt">
<rect x=3D"12.5" y=3D"12.5" width=3D"100" height=3D"100" fill=3D"black"
stroke=3D"none"/>
<rect x=3D"10pt" y=3D"10pt" width=3D"80pt" height=3D"80pt" fill=3D"none"
stroke=3D"red" stroke-width=3D"1pt"/>
</svg>
and:
<svg width=3D"100pt" height=3D"100pt" viewBox=3D"0 0 125 125">
<rect x=3D"12.5" y=3D"12.5" width=3D"100" height=3D"100" fill=3D"black"
stroke=3D"none"/>
<rect x=3D"10pt" y=3D"10pt" width=3D"80pt" height=3D"80pt" fill=3D"none"
stroke=3D"red" stroke-width=3D"1pt"/>
</svg>
Well, hrm. Having just tried this with Batik, I think it reveals a
fundamental misunderstanding I had about viewBox.
So, for the document root it appears that the relationship between pixel
and non-pixel measurements can never be guaranteed to be fixed between
different UAs/display devices.
Doesn't this mean that Sodipodi should probably be using pixel
measurements, not real-world units, for the height/width properties of
the root SVG element? (and probably using e.g. sodipodi:height and
sodipodi:width, or possibly sodipodi:dpi to derive the real-world
measurements the UI uses?)
Otherwise, in other SVG UAs, the relationship between the drawing and
page size is not guaranteed to be the same.
-mental
|