[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
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.
> Emmanuel Pacaud wrote:
>>>From the SVG specification:
>> "the em and ex unit identifiers are relative to the
>> 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
>> 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
>> initialization time). For example, suppose that the user
>> determine from its environment that "1px" corresponds to
>> "0.2822222mm" (i.e., 90dpi). Then, for all processing of
>> * "1pt" equals "1.25px" (and therefore 1.25 user
>> * "1pc" equals "15px" (and therefore 15 user
>> * "1mm" would be "3.543307px" (3.543307 user
>> * "1cm" equals "35.43307px" (and therefore
>>35.43307 user units)
>> * "1in" equals "90px" (and therefore 90 user
>> In the SVG files produced by cairo, the use of the
>> 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.
> 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:
> The Foundry Visionmongers Ltd * Registered in England
>and Wales No: 4642027
> cairo mailing list
> cairo at cairographics.org
More information about the cairo