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

Behdad Esfahbod behdad at behdad.org
Fri Oct 24 05:10:54 PDT 2008

Asko Kauppi wrote:
> Cairo API gives SVG dimension in points (1 point == 1/72.0 inch).   
> However, I'd need to create a file with pixel precise dimensions, that  
> is without the "pt" in the output stream:
> 	<?xml version="1.0" encoding="UTF-8"?>
> 	<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink 
> " width="1000pt" height="903pt" viewBox="0 0 1000 903" version="1.1">
> 	 <defs> <g>...
> Can this be done in any other way than cutting the "pt" simply off in  
> the output filter function?   That seems rather harsh.
> Is there a reason behind only supporting one mode (SVG allows "em, ex,  
> px, pt, pc, cm, mm, in, and percentages"), or is it simply how it is  
> for now?

I'm pretty SVG-illiterate, so bear with me.  What's the unit the viewBox and
the body content coordinates are expressed in?  If that's always points, then
I think cairo is doing the right thing.

For most of the physical units SVG allows (pc, cm, mm, in), it's a matter of a
fixed ratio to pt.  I don't know what the percentage refers to.  I also don't
know what the font-specific units em and ex refer to.  For px, again, it's
probably assuming a 72dpi device?  In which case it's the same as pt.


> - Asko
> _______________________________________________
> cairo mailing list
> cairo at cairographics.org
> http://lists.cairographics.org/mailman/listinfo/cairo

More information about the cairo mailing list