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

Emmanuel Pacaud emmanuel.pacaud at lapp.in2p3.fr
Fri Oct 24 12:36:34 PDT 2008


Le vendredi 24 octobre 2008 à 12:09 -0700, Bill Spitzak a écrit :
> 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.

But if you want to use cairo in order to output a CD label you want to
print later, an image size in pixel doesn't make sense.

I guess we should have an option for either use pt or px for the SVG
image size.

	Emmanuel.

> 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.
> 



More information about the cairo mailing list