[cairo] SVG output without "pt" in the coordinates - how?
askok at dnainternet.net
askok at dnainternet.net
Sat Oct 25 01:40:12 PDT 2008
On Fri, 24 Oct 2008 12:09:17 -0700
Bill Spitzak <spitzak at thefoundry.co.uk> wrote:
> From this description, it sure sounds to me like Cairo
>should *not* be
> putting "pt" in the data.
>
> Use cairo to produce a .png file. Use cairo with the
>same calls to
> produce an SVG file. View both of them using typical
>image and svg
> viewing software. If the results are not the same size,
>then Cairo is WRONG.
It's not really wrong, since the constructors for such
surfaces differ. The problem is that the only SVG surface
constructor is specified as using points.
To me the solution of allowing either pixel, or point
usage, at the SVG surface constructor is the right
solution.
Maybe it should be more generic, though, since also
picture files can have a notion of resolution embedded to
them (like scanned with 300dpi or 600dpi or...). I will
gladly :) leave this to Cairo authors to figure out.
btw, THANKS for the library. I'm using it in all my
graphics creation nowadays, both at work and out of work.
-asko
>
> Emmanuel Pacaud wrote:
>>>From the SVG specification:
>>
>> "the em and ex unit identifiers are relative to the
>>current font's
>> font-size and x-height, respectively."
>>
>> "The other absolute unit identifiers from CSS (i.e., pt,
>>pc, cm, mm, in)
>> are all defined as an appropriate multiple of one px
>>unit (which,
>> according to the previous item, is defined to be equal
>>to one user
>> unit), based on what the SVG user agent determines is
>>the size of a px
>> unit (possibly passed from the parent processor or
>>environment at
>> initialization time). For example, suppose that the user
>>agent can
>> determine from its environment that "1px" corresponds to
>> "0.2822222mm" (i.e., 90dpi). Then, for all processing of
>>SVG content:
>>
>> * "1pt" equals "1.25px" (and therefore 1.25 user
>>units)
>> * "1pc" equals "15px" (and therefore 15 user
>>units)
>> * "1mm" would be "3.543307px" (3.543307 user
>>units)
>> * "1cm" equals "35.43307px" (and therefore
>>35.43307 user units)
>> * "1in" equals "90px" (and therefore 90 user
>>units)
>> "
>>
>> In the SVG files produced by cairo, the use of the
>>viewbox attribute
>> makes "pt" the default unit, instead of "px".
>>
>> If you want to render these files with 1 px = 1 pt, just
>>set the ppi of
>> your renderer to 72.
>>
>> Emmanuel.
>
> --
> Bill Spitzak, Senior Software Engineer
> The Foundry, 618 Hampton Drive, Venice, CA, 90291, USA
> Tel: +1 310 399-4555 * Fax: +1 310 450-4516 * Web:
>www.thefoundry.co.uk
> The Foundry Visionmongers Ltd * Registered in England
>and Wales No: 4642027
> _______________________________________________
> cairo mailing list
> cairo at cairographics.org
> http://lists.cairographics.org/mailman/listinfo/cairo
More information about the cairo
mailing list