[cairo] SVG output without "pt" in the coordinates - how?

Bill Spitzak spitzak at thefoundry.co.uk
Fri Oct 24 12:09:17 PDT 2008

 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.

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

More information about the cairo mailing list