Gets or sets whether or not hairline mode is set within the Cairo context.
Hairlines are logically zero-width lines that are drawn at the thinnest
renderable width possible in the current Cairo context.
On surfaces with native hairline support, the native hairline functionality
will be used. Surfaces that support hairlines include:
- pdf/ps
- Encoded as 0-width line.
- win32_printing
- Rendered with the PS_COSMETIC pen.
- svg
- Encoded as 1 px non-scaling-stroke.
- script
- Encoded with the set-hairline function.
Cairo will always render hairlines at 1 device unit wide, even if an
anisotropic scaling was applied to the stroke width. In the wild, handling
of this situation is not well-defined. Some PDF, PS, and SVG renderers match
the output of Cairo, but some very popular implementations (Acrobat, Chrome,
rsvg) will scale the hairline unevenly. As such, best practice is to reset any anisotropic scaling before calling the
cairo:stroke function. See
Ellipses With Uniform Stroke Width for an example.
Since 1.18