plug-ins: fix comment explaining cairo_save().

Current comment was implying that PDF had some kind of fixed PPI, or
that a 72 PPI was hardcoded in cairo. This is not at all what this is
about. Cairo simply has a concept of user-space coordinates, and from
what I gather, it seems that this is set as "point", the typographical
unit of measure (not as a screen point). In such context, cairo_scale()
is used to update the transformation matrix (which will transform from
user to device units, i.e. pixels) so that we can draw with pixels. In
other words, both the user and device units will be pixels in subsequent
calls.
It turns out that 1 inch == 72 points. This is not a PPI/DPI at all and
the comment was completely misleading.
This commit is contained in:
Jehan 2017-06-19 23:46:46 +02:00
parent a2b438cc82
commit e2d1a57ebd
1 changed files with 6 additions and 2 deletions
plug-ins/common

View File

@ -542,8 +542,12 @@ run (const gchar *name,
*/
cairo_surface_set_fallback_resolution (pdf_file, x_res, y_res);
/* PDF is usually 72 points per inch. If we have a different resolution,
* we will need this to fit our drawings
/* Cairo has a concept of user-space vs device-space units.
* From what I understand, by default the user-space unit is the
* typographical "point". Since we work mostly with pixels, not
* points, the following call simply scales the transformation
* matrix from points to pixels, relatively to the image
* resolution, knowing that 1 typographical point == 1/72 inch.
*/
cairo_scale (cr, x_scale, y_scale);