Package: cairo

Function cairo:svg-surface-document-unit

Lambda List

cairo:svg-surface-document-unit (surface)

Syntax

(cairo:svg-surface-document-unit surface) => unit
(setf (cairo:svg-surface-document-unit surface) unit)

Arguments

surface -- a cairo:surface-t instance
unit -- a cairo:svg-unit-t value

Details

The cairo:svg-surface-document-unit function gets the unit of the SVG surface. If the surface passed as an argument is not a SVG surface, the function sets the error status to CAIRO_STATUS_SURFACE_TYPE_MISMATCH and returns CAIRO_SVG_UNIT_USER.

The (setf cairo:svg-surface-document-unit) function sets the unit for use with the specified width and height of the generated SVG file. See the cairo:svg-unit-t enumeration for a list of available unit values that can be used here.

This function can be called at any time before generating the SVG file.

However to minimize the risk of ambiguities it is recommended to call it before any drawing operations have been performed on the given surface, to make it clearer what the unit used in the drawing operations is. The simplest way to do this is to call this function immediately after creating the SVG surface.

Note if this function is never called, the default unit for SVG documents generated by cairo will be :pt. This is for historical reasons.
 

See also

#2025-1-13