| 1 |
Python API reference |
| 2 |
#################### |
| 3 |
|
| 4 |
.. currentmodule:: cairocffi |
| 5 |
|
| 6 |
|
| 7 |
Meta |
| 8 |
==== |
| 9 |
|
| 10 |
.. autofunction:: install_as_pycairo |
| 11 |
.. autofunction:: cairo_version |
| 12 |
.. autofunction:: cairo_version_string |
| 13 |
.. autoexception:: CairoError |
| 14 |
.. data:: Error |
| 15 |
|
| 16 |
An alias for :exc:`CairoError`, for compatibility with pycairo. |
| 17 |
|
| 18 |
|
| 19 |
Surfaces |
| 20 |
======== |
| 21 |
.. autoclass:: Surface |
| 22 |
:members: |
| 23 |
|
| 24 |
ImageSurface |
| 25 |
------------ |
| 26 |
.. autoclass:: ImageSurface |
| 27 |
:members: |
| 28 |
|
| 29 |
PDFSurface |
| 30 |
---------- |
| 31 |
.. autoclass:: PDFSurface |
| 32 |
:members: |
| 33 |
|
| 34 |
PSSurface |
| 35 |
--------- |
| 36 |
.. autoclass:: PSSurface |
| 37 |
:members: |
| 38 |
|
| 39 |
SVGSurface |
| 40 |
---------- |
| 41 |
.. autoclass:: SVGSurface |
| 42 |
:members: |
| 43 |
|
| 44 |
RecordingSurface |
| 45 |
---------------- |
| 46 |
.. autoclass:: RecordingSurface |
| 47 |
:members: |
| 48 |
|
| 49 |
Win32PrintingSurface |
| 50 |
-------------------- |
| 51 |
.. autoclass:: Win32PrintingSurface |
| 52 |
:members: |
| 53 |
|
| 54 |
Context |
| 55 |
======= |
| 56 |
.. autoclass:: Context |
| 57 |
:members: |
| 58 |
|
| 59 |
|
| 60 |
Matrix |
| 61 |
====== |
| 62 |
.. autoclass:: Matrix |
| 63 |
:members: |
| 64 |
|
| 65 |
|
| 66 |
Patterns |
| 67 |
======== |
| 68 |
.. autoclass:: Pattern() |
| 69 |
:members: |
| 70 |
|
| 71 |
SolidPattern |
| 72 |
------------ |
| 73 |
.. autoclass:: SolidPattern |
| 74 |
:members: |
| 75 |
|
| 76 |
SurfacePattern |
| 77 |
-------------- |
| 78 |
.. autoclass:: SurfacePattern |
| 79 |
:members: |
| 80 |
|
| 81 |
Gradient |
| 82 |
-------- |
| 83 |
.. autoclass:: Gradient() |
| 84 |
:members: |
| 85 |
|
| 86 |
LinearGradient |
| 87 |
.............. |
| 88 |
.. autoclass:: LinearGradient |
| 89 |
:members: |
| 90 |
|
| 91 |
RadialGradient |
| 92 |
.............. |
| 93 |
.. autoclass:: RadialGradient |
| 94 |
:members: |
| 95 |
|
| 96 |
|
| 97 |
.. _fonts: |
| 98 |
|
| 99 |
Fonts & text |
| 100 |
============ |
| 101 |
|
| 102 |
A font is (in simple terms) a collection of shapes used to draw text. |
| 103 |
A *glyph* is one of these shapes. |
| 104 |
There can be multiple glyphs for the same character |
| 105 |
(alternates to be used in different contexts, for example), |
| 106 |
or a glyph can be a ligature of multiple characters. |
| 107 |
Converting text to positioned glyphs is *shaping*. |
| 108 |
|
| 109 |
Cairo itself provides a "toy" text API that only does simple shaping: |
| 110 |
no ligature or kerning; |
| 111 |
one glyph per character, |
| 112 |
positioned by moving the cursor by the X and Y *advance* of each glyph. |
| 113 |
|
| 114 |
It is expected that most applications will need to |
| 115 |
:ref:`use Pango <using_pango>` or a similar library in conjunction with cairo |
| 116 |
for more comprehensive font handling and text layout. |
| 117 |
|
| 118 |
|
| 119 |
Font faces |
| 120 |
---------- |
| 121 |
|
| 122 |
.. note:: |
| 123 |
|
| 124 |
At the moment cairocffi only supports cairo’s "toy" font selection API. |
| 125 |
:class:`FontFace` objects of other types could be obtained |
| 126 |
eg. from :meth:`Context.get_font_face`, |
| 127 |
but they can not be instantiated directly. |
| 128 |
|
| 129 |
.. autoclass:: FontFace() |
| 130 |
:members: |
| 131 |
|
| 132 |
ToyFontFace |
| 133 |
........... |
| 134 |
.. autoclass:: ToyFontFace |
| 135 |
:members: |
| 136 |
|
| 137 |
|
| 138 |
ScaledFont |
| 139 |
---------- |
| 140 |
.. autoclass:: ScaledFont |
| 141 |
:members: |
| 142 |
|
| 143 |
FontOptions |
| 144 |
----------- |
| 145 |
.. autoclass:: FontOptions(**values) |
| 146 |
:members: |
| 147 |
|
| 148 |
|
| 149 |
Enumerated values |
| 150 |
================= |
| 151 |
|
| 152 |
Some parameters or return values in the cairo API |
| 153 |
only have a fixed, finite set of valid values. |
| 154 |
These are represented as *enumerated types* in C, and as integers in CFFI. |
| 155 |
Users are encouraged to use the constants defined here |
| 156 |
in the ``cairocffi`` module |
| 157 |
rather than literal integers. |
| 158 |
For example:: |
| 159 |
|
| 160 |
surface = cairocffi.ImageSurface(cairocffi.FORMAT_ARGB32, 300, 400) |
| 161 |
|
| 162 |
|
| 163 |
Content |
| 164 |
------- |
| 165 |
|
| 166 |
Used to describe the content that a :class:`Surface` will contain, |
| 167 |
whether color information, alpha information (translucence vs. opacity), |
| 168 |
or both. |
| 169 |
|
| 170 |
|
| 171 |
.. data:: CONTENT_COLOR |
| 172 |
|
| 173 |
The surface will hold color content only. |
| 174 |
|
| 175 |
|
| 176 |
.. data:: CONTENT_ALPHA |
| 177 |
|
| 178 |
The surface will hold alpha content only. |
| 179 |
|
| 180 |
|
| 181 |
.. data:: CONTENT_COLOR_ALPHA |
| 182 |
|
| 183 |
The surface will hold color and alpha content. |
| 184 |
|
| 185 |
|
| 186 |
.. _FORMAT: |
| 187 |
|
| 188 |
Pixel format |
| 189 |
------------ |
| 190 |
|
| 191 |
Used to identify the memory format of image data. |
| 192 |
|
| 193 |
.. data:: FORMAT_ARGB32 |
| 194 |
|
| 195 |
Each pixel is a 32-bit quantity, |
| 196 |
with alpha in the upper 8 bits, then red, then green, then blue. |
| 197 |
The 32-bit quantities are stored native-endian. |
| 198 |
Pre-multiplied alpha is used. |
| 199 |
(That is, 50% transparent red is 0x80800000, not 0x80ff0000.) |
| 200 |
|
| 201 |
.. data:: FORMAT_RGB24 |
| 202 |
|
| 203 |
Each pixel is a 32-bit quantity, with the upper 8 bits unused. |
| 204 |
Red, Green, and Blue are stored in the remaining 24 bits in that order. |
| 205 |
|
| 206 |
.. data:: FORMAT_A8 |
| 207 |
|
| 208 |
Each pixel is a 8-bit quantity holding an alpha value. |
| 209 |
|
| 210 |
.. data:: FORMAT_A1 |
| 211 |
|
| 212 |
Each pixel is a 1-bit quantity holding an alpha value. |
| 213 |
Pixels are packed together into 32-bit quantities. |
| 214 |
The ordering of the bits matches the endianess of the platform. |
| 215 |
On a big-endian machine, the first pixel is in the uppermost bit, |
| 216 |
on a little-endian machine the first pixel is in the least-significant bit. |
| 217 |
|
| 218 |
.. data:: FORMAT_RGB16_565 |
| 219 |
|
| 220 |
Each pixel is a 16-bit quantity |
| 221 |
with red in the upper 5 bits, |
| 222 |
then green in the middle 6 bits, |
| 223 |
and blue in the lower 5 bits. |
| 224 |
|
| 225 |
.. data:: FORMAT_RGB30 |
| 226 |
|
| 227 |
Like :obj:`FORMAT_RGB24`, |
| 228 |
but with the upper 2 bits unused and 10 bits per components. |
| 229 |
|
| 230 |
|
| 231 |
.. _OPERATOR: |
| 232 |
|
| 233 |
Compositiong operator |
| 234 |
--------------------- |
| 235 |
|
| 236 |
Used to set the compositing operator for all cairo drawing operations. |
| 237 |
|
| 238 |
The default operator is :obj:`OPERATOR_OVER`. |
| 239 |
|
| 240 |
The operators marked as **unbounded** modify their destination |
| 241 |
even outside of the mask layer |
| 242 |
(that is, their effect is not bound by the mask layer). |
| 243 |
However, their effect can still be limited by way of clipping. |
| 244 |
|
| 245 |
To keep things simple, the operator descriptions here |
| 246 |
document the behavior for when both source and destination are either |
| 247 |
fully transparent or fully opaque. |
| 248 |
The actual implementation works for translucent layers too. |
| 249 |
For a more detailed explanation of the effects of each operator, |
| 250 |
including the mathematical definitions, |
| 251 |
see `http://cairographics.org/operators/ <http://cairographics.org/operators/>`_. |
| 252 |
|
| 253 |
|
| 254 |
|
| 255 |
.. data:: OPERATOR_CLEAR |
| 256 |
|
| 257 |
Clear destination layer. (bounded) |
| 258 |
|
| 259 |
.. data:: OPERATOR_SOURCE |
| 260 |
|
| 261 |
Replace destination layer. (bounded) |
| 262 |
|
| 263 |
.. data:: OPERATOR_OVER |
| 264 |
|
| 265 |
Draw source layer on top of destination layer. (bounded) |
| 266 |
|
| 267 |
.. data:: OPERATOR_IN |
| 268 |
|
| 269 |
Draw source where there was destination content. (unbounded) |
| 270 |
|
| 271 |
.. data:: OPERATOR_OUT |
| 272 |
|
| 273 |
Draw source where there was no destination content. (unbounded) |
| 274 |
|
| 275 |
.. data:: OPERATOR_ATOP |
| 276 |
|
| 277 |
Draw source on top of destination content and only there. |
| 278 |
|
| 279 |
.. data:: OPERATOR_DEST |
| 280 |
|
| 281 |
Ignore the source. |
| 282 |
|
| 283 |
.. data:: OPERATOR_DEST_OVER |
| 284 |
|
| 285 |
Draw destination on top of source. |
| 286 |
|
| 287 |
.. data:: OPERATOR_DEST_IN |
| 288 |
|
| 289 |
Leave destination only where there was source content. (unbounded) |
| 290 |
|
| 291 |
.. data:: OPERATOR_DEST_OUT |
| 292 |
|
| 293 |
Leave destination only where there was no source content. |
| 294 |
|
| 295 |
.. data:: OPERATOR_DEST_ATOP |
| 296 |
|
| 297 |
Leave destination on top of source content and only there. (unbounded) |
| 298 |
|
| 299 |
.. data:: OPERATOR_XOR |
| 300 |
|
| 301 |
Source and destination are shown where there is only one of them. |
| 302 |
|
| 303 |
.. data:: OPERATOR_ADD |
| 304 |
|
| 305 |
Source and destination layers are accumulated. |
| 306 |
|
| 307 |
.. data:: OPERATOR_SATURATE |
| 308 |
|
| 309 |
Like :obj:`OPERATOR_OVER`, |
| 310 |
but assuming source and destination are disjoint geometries. |
| 311 |
|
| 312 |
.. data:: OPERATOR_MULTIPLY |
| 313 |
|
| 314 |
Source and destination layers are multiplied. |
| 315 |
This causes the result to be at least as dark as the darker inputs. |
| 316 |
(Since 1.10) |
| 317 |
|
| 318 |
|
| 319 |
.. data:: OPERATOR_SCREEN |
| 320 |
|
| 321 |
Source and destination are complemented and multiplied. |
| 322 |
This causes the result to be at least as light as the lighter inputs. |
| 323 |
(Since cairo 1.10) |
| 324 |
|
| 325 |
|
| 326 |
.. data:: OPERATOR_OVERLAY |
| 327 |
|
| 328 |
Multiplies or screens, depending on the lightness of the destination color. |
| 329 |
(Since cairo 1.10) |
| 330 |
|
| 331 |
.. data:: OPERATOR_DARKEN |
| 332 |
|
| 333 |
Replaces the destination with the source if it is darker, |
| 334 |
otherwise keeps the source. (Since cairo 1.10) |
| 335 |
|
| 336 |
|
| 337 |
.. data:: OPERATOR_LIGHTEN |
| 338 |
|
| 339 |
Replaces the destination with the source if it is lighter, |
| 340 |
otherwise keeps the source. (Since cairo 1.10) |
| 341 |
|
| 342 |
|
| 343 |
.. data:: OPERATOR_COLOR_DODGE |
| 344 |
|
| 345 |
Brightens the destination color to reflect the source color. |
| 346 |
(Since cairo 1.10) |
| 347 |
|
| 348 |
|
| 349 |
.. data:: OPERATOR_COLOR_BURN |
| 350 |
|
| 351 |
Darkens the destination color to reflect the source color. |
| 352 |
(Since cairo 1.10) |
| 353 |
|
| 354 |
|
| 355 |
.. data:: OPERATOR_HARD_LIGHT |
| 356 |
|
| 357 |
Multiplies or screens, dependent on source color. (Since cairo 1.10) |
| 358 |
|
| 359 |
|
| 360 |
.. data:: OPERATOR_SOFT_LIGHT |
| 361 |
|
| 362 |
Darkens or lightens, dependent on source color. (Since cairo 1.10) |
| 363 |
|
| 364 |
|
| 365 |
.. data:: OPERATOR_DIFFERENCE |
| 366 |
|
| 367 |
Takes the difference of the source and destination color. |
| 368 |
(Since cairo 1.10) |
| 369 |
|
| 370 |
|
| 371 |
.. data:: OPERATOR_EXCLUSION |
| 372 |
|
| 373 |
Produces an effect similar to difference, but with lower contrast. |
| 374 |
(Since cairo 1.10) |
| 375 |
|
| 376 |
.. data:: OPERATOR_HSL_HUE |
| 377 |
|
| 378 |
Creates a color with the hue of the source |
| 379 |
and the saturation and luminosity of the target. (Since cairo 1.10) |
| 380 |
|
| 381 |
.. data:: OPERATOR_HSL_SATURATION |
| 382 |
|
| 383 |
Creates a color with the saturation of the source |
| 384 |
and the hue and luminosity of the target. |
| 385 |
Painting with this mode onto a gray area produces no change. |
| 386 |
(Since cairo 1.10) |
| 387 |
|
| 388 |
.. data:: OPERATOR_HSL_COLOR |
| 389 |
|
| 390 |
Creates a color with the hue and saturation of the source |
| 391 |
and the luminosity of the target. |
| 392 |
This preserves the gray levels of the target |
| 393 |
and is useful for coloring monochrome images or tinting color images. |
| 394 |
(Since cairo 1.10) |
| 395 |
|
| 396 |
.. data:: OPERATOR_HSL_LUMINOSITY |
| 397 |
|
| 398 |
Creates a color with the luminosity of the source |
| 399 |
and the hue and saturation of the target. |
| 400 |
This produces an inverse effect to :obj:`OPERATOR_HSL_COLOR`. |
| 401 |
(Since cairo 1.10) |
| 402 |
|
| 403 |
|
| 404 |
.. _ANTIALIAS: |
| 405 |
|
| 406 |
Antialiasing mode |
| 407 |
----------------- |
| 408 |
|
| 409 |
Specifies the type of antialiasing to do when rendering text or shapes. |
| 410 |
|
| 411 |
.. data:: ANTIALIAS_DEFAULT |
| 412 |
|
| 413 |
Use the default antialiasing for the subsystem and target device. |
| 414 |
|
| 415 |
.. data:: ANTIALIAS_NONE |
| 416 |
|
| 417 |
Use a bilevel alpha mask. |
| 418 |
|
| 419 |
.. data:: ANTIALIAS_GRAY |
| 420 |
|
| 421 |
Perform single-color antialiasing. |
| 422 |
|
| 423 |
.. data:: ANTIALIAS_SUBPIXEL |
| 424 |
|
| 425 |
Perform antialiasing by taking advantage of the order |
| 426 |
of subpixel elements on devices such as LCD panels. |
| 427 |
|
| 428 |
As it is not necessarily clear from the above what advantages |
| 429 |
a particular antialias method provides, |
| 430 |
since cairo 1.12, there is also a set of hints: |
| 431 |
|
| 432 |
.. data:: ANTIALIAS_FAST |
| 433 |
|
| 434 |
Allow the backend to degrade raster quality for speed. |
| 435 |
|
| 436 |
.. data:: ANTIALIAS_GOOD |
| 437 |
|
| 438 |
A balance between speed and quality. |
| 439 |
|
| 440 |
.. data:: ANTIALIAS_BEST |
| 441 |
|
| 442 |
A high-fidelity, but potentially slow, raster mode. |
| 443 |
|
| 444 |
These make no guarantee on how the backend will perform its rasterisation |
| 445 |
(if it even rasterises!), |
| 446 |
nor that they have any differing effect other than to enable |
| 447 |
some form of antialiasing. |
| 448 |
In the case of glyph rendering, |
| 449 |
:obj:`ANTIALIAS_FAST` and :obj:`ANTIALIAS_GOOD` |
| 450 |
will be mapped to :obj:`ANTIALIAS_GRAY`, |
| 451 |
with :obj:`ANTIALIAS_BEST` being equivalent to :obj:`ANTIALIAS_SUBPIXEL`. |
| 452 |
|
| 453 |
The interpretation of :obj:`ANTIALIAS_DEFAULT` is left entirely up to |
| 454 |
the backend, typically this will be similar to :obj:`ANTIALIAS_GOOD`. |
| 455 |
|
| 456 |
|
| 457 |
.. _FILL_RULE: |
| 458 |
|
| 459 |
Fill rule |
| 460 |
--------- |
| 461 |
|
| 462 |
Used to select how paths are filled. |
| 463 |
For both fill rules, whether or not a point is included in the fill |
| 464 |
is determined by taking a ray from that point to infinity |
| 465 |
and looking at intersections with the path. |
| 466 |
The ray can be in any direction, |
| 467 |
as long as it doesn't pass through the end point of a segment |
| 468 |
or have a tricky intersection such as intersecting tangent to the path. |
| 469 |
(Note that filling is not actually implemented in this way. |
| 470 |
This is just a description of the rule that is applied.) |
| 471 |
|
| 472 |
The default fill rule is :obj:`FILL_RULE_WINDING`. |
| 473 |
|
| 474 |
New entries may be added in future versions. |
| 475 |
|
| 476 |
|
| 477 |
.. data:: FILL_RULE_WINDING |
| 478 |
|
| 479 |
If the path crosses the ray fromleft-to-right, counts +1. |
| 480 |
If the path crosses the rayfrom right to left, counts -1. |
| 481 |
(Left and right are determined from the perspective |
| 482 |
of looking along the ray from the starting point.) |
| 483 |
If the total count is non-zero, the point will be filled. |
| 484 |
|
| 485 |
.. data:: FILL_RULE_EVEN_ODD |
| 486 |
|
| 487 |
Counts the total number of intersections, |
| 488 |
without regard to the orientation of the contour. |
| 489 |
If the total number of intersections is odd, the point will be filled. |
| 490 |
|
| 491 |
|
| 492 |
.. _LINE_CAP: |
| 493 |
|
| 494 |
Line cap style |
| 495 |
-------------- |
| 496 |
|
| 497 |
Specifies how to render the endpoints of the path when stroking. |
| 498 |
|
| 499 |
The default line cap style is :obj:`LINE_CAP_BUTT`. |
| 500 |
|
| 501 |
.. data:: LINE_CAP_BUTT |
| 502 |
|
| 503 |
Start (stop) the line exactly at the start (end) point. |
| 504 |
|
| 505 |
.. data:: LINE_CAP_ROUND |
| 506 |
|
| 507 |
Use a round ending, the center of the circle is the end point. |
| 508 |
|
| 509 |
.. data:: LINE_CAP_SQUARE |
| 510 |
|
| 511 |
Use squared ending, the center of the square is the end point. |
| 512 |
|
| 513 |
|
| 514 |
.. _LINE_JOIN: |
| 515 |
|
| 516 |
Line join style |
| 517 |
--------------- |
| 518 |
|
| 519 |
Specifies how to render the junction of two lines when stroking. |
| 520 |
|
| 521 |
The default line join style is :obj:`LINE_JOIN_MITER`. |
| 522 |
|
| 523 |
|
| 524 |
.. data:: LINE_JOIN_MITER |
| 525 |
|
| 526 |
Use a sharp (angled) corner, see :meth:`Context.set_miter_limit`. |
| 527 |
|
| 528 |
.. data:: LINE_JOIN_ROUND |
| 529 |
|
| 530 |
Use a rounded join, the center of the circle is the joint point. |
| 531 |
|
| 532 |
.. data:: LINE_JOIN_BEVEL |
| 533 |
|
| 534 |
Use a cut-off join, the join is cut off at half the line width |
| 535 |
from the joint point. |
| 536 |
|
| 537 |
|
| 538 |
.. _FONT_SLANT: |
| 539 |
|
| 540 |
Font slant |
| 541 |
---------- |
| 542 |
|
| 543 |
Specifies variants of a font face based on their slant. |
| 544 |
|
| 545 |
.. data:: FONT_SLANT_NORMAL |
| 546 |
|
| 547 |
Upright font style. |
| 548 |
|
| 549 |
.. data:: FONT_SLANT_ITALIC |
| 550 |
|
| 551 |
Italic font style. |
| 552 |
|
| 553 |
.. data:: FONT_SLANT_OBLIQUE |
| 554 |
|
| 555 |
Oblique font style. |
| 556 |
|
| 557 |
|
| 558 |
.. _FONT_WEIGHT: |
| 559 |
|
| 560 |
Font weight |
| 561 |
----------- |
| 562 |
|
| 563 |
Specifies variants of a font face based on their weight. |
| 564 |
|
| 565 |
.. data:: FONT_WEIGHT_NORMAL |
| 566 |
|
| 567 |
Normal font weight. |
| 568 |
|
| 569 |
.. data:: FONT_WEIGHT_BOLD |
| 570 |
|
| 571 |
Bold font weight. |
| 572 |
|
| 573 |
|
| 574 |
.. _SUBPIXEL_ORDER: |
| 575 |
|
| 576 |
Subpixel order |
| 577 |
-------------- |
| 578 |
|
| 579 |
The subpixel order specifies the order of color elements within each pixel |
| 580 |
on the display device when rendering with an antialiasing mode of |
| 581 |
:obj:`ANTIALIAS_SUBPIXEL`. |
| 582 |
|
| 583 |
|
| 584 |
.. data:: SUBPIXEL_ORDER_DEFAULT |
| 585 |
|
| 586 |
Use the default subpixel order for for the target device. |
| 587 |
|
| 588 |
.. data:: SUBPIXEL_ORDER_RGB |
| 589 |
|
| 590 |
Subpixel elements are arranged horizontally with red at the left. |
| 591 |
|
| 592 |
.. data:: SUBPIXEL_ORDER_BGR |
| 593 |
|
| 594 |
Subpixel elements are arranged horizontally with blue at the left. |
| 595 |
|
| 596 |
.. data:: SUBPIXEL_ORDER_VRGB |
| 597 |
|
| 598 |
Subpixel elements are arranged vertically with red at the top. |
| 599 |
|
| 600 |
.. data:: SUBPIXEL_ORDER_VBGR |
| 601 |
|
| 602 |
Subpixel elements are arranged vertically with blue at the top. |
| 603 |
|
| 604 |
|
| 605 |
.. _HINT_STYLE: |
| 606 |
|
| 607 |
Hint style |
| 608 |
---------- |
| 609 |
|
| 610 |
Specifies the type of hinting to do on font outlines. |
| 611 |
Hinting is the process of fitting outlines to the pixel grid |
| 612 |
in order to improve the appearance of the result. |
| 613 |
Since hinting outlines involves distorting them, |
| 614 |
it also reduces the faithfulness to the original outline shapes. |
| 615 |
Not all of the outline hinting styles are supported by all font backends. |
| 616 |
|
| 617 |
New entries may be added in future versions. |
| 618 |
|
| 619 |
|
| 620 |
.. data:: HINT_STYLE_DEFAULT |
| 621 |
|
| 622 |
Use the default hint style for font backend and target device. |
| 623 |
|
| 624 |
.. data:: HINT_STYLE_NONE |
| 625 |
|
| 626 |
Do not hint outlines. |
| 627 |
|
| 628 |
.. data:: HINT_STYLE_SLIGHT |
| 629 |
|
| 630 |
Hint outlines slightly to improve contrast |
| 631 |
while retaining good fidelity to the original shapes. |
| 632 |
|
| 633 |
.. data:: HINT_STYLE_MEDIUM |
| 634 |
|
| 635 |
Hint outlines with medium strength |
| 636 |
giving a compromise between fidelity to the original shapes and contrast. |
| 637 |
|
| 638 |
.. data:: HINT_STYLE_FULL |
| 639 |
|
| 640 |
Hint outlines to maximize contrast. |
| 641 |
|
| 642 |
|
| 643 |
.. _HINT_METRICS: |
| 644 |
|
| 645 |
Metrics hinting mode |
| 646 |
-------------------- |
| 647 |
|
| 648 |
Specifies whether to hint font metrics; |
| 649 |
hinting font metrics means quantizing them |
| 650 |
so that they are integer values in device space. |
| 651 |
Doing this improves the consistency of letter and line spacing, |
| 652 |
however it also means that text will be laid out differently |
| 653 |
at different zoom factors. |
| 654 |
|
| 655 |
|
| 656 |
.. data:: HINT_METRICS_DEFAULT |
| 657 |
|
| 658 |
Hint metrics in the default manner for the font backend and target device. |
| 659 |
|
| 660 |
.. data:: HINT_METRICS_OFF |
| 661 |
|
| 662 |
Do not hint font metrics. |
| 663 |
|
| 664 |
.. data:: HINT_METRICS_ON |
| 665 |
|
| 666 |
Hint font metrics. |
| 667 |
|
| 668 |
.. |
| 669 |
.. _FONT_TYPE: |
| 670 |
|
| 671 |
Font type |
| 672 |
--------- |
| 673 |
|
| 674 |
Used to describe the type of a given font face or scaled font. |
| 675 |
The font types are also known as "font backends" within cairo. |
| 676 |
|
| 677 |
The type of a font face is determined by the function used to create it. |
| 678 |
|
| 679 |
The type of a scaled font is determined by the type of the font face |
| 680 |
passed to :class:`ScaledFont`. |
| 681 |
|
| 682 |
New entries may be added in future versions. |
| 683 |
|
| 684 |
|
| 685 |
.. data:: FONT_TYPE_TOY |
| 686 |
|
| 687 |
The font was created using cairo's toy font api. |
| 688 |
|
| 689 |
.. data:: FONT_TYPE_FT |
| 690 |
|
| 691 |
The font is of type FreeType. |
| 692 |
|
| 693 |
.. data:: FONT_TYPE_WIN32 |
| 694 |
|
| 695 |
The font is of type Win32. |
| 696 |
|
| 697 |
.. data:: FONT_TYPE_QUARTZ |
| 698 |
|
| 699 |
The font is of type Quartz. |
| 700 |
|
| 701 |
.. data:: FONT_TYPE_USER |
| 702 |
|
| 703 |
The font was create using cairo's user font api. (Since cairo 1.8) |
| 704 |
|
| 705 |
|
| 706 |
.. _PATH_OPERATION: |
| 707 |
|
| 708 |
Path operation |
| 709 |
-------------- |
| 710 |
|
| 711 |
Used to describe the type of one portion of a path when represented as a list. |
| 712 |
See :meth:`Context.copy_path` for details. |
| 713 |
|
| 714 |
|
| 715 |
.. data:: PATH_MOVE_TO |
| 716 |
|
| 717 |
.. data:: PATH_LINE_TO |
| 718 |
|
| 719 |
.. data:: PATH_CURVE_TO |
| 720 |
|
| 721 |
.. data:: PATH_CLOSE_PATH |
| 722 |
|
| 723 |
|
| 724 |
.. _EXTEND: |
| 725 |
|
| 726 |
Pattern extend |
| 727 |
-------------- |
| 728 |
|
| 729 |
Used to describe how pattern color/alpha will be determined |
| 730 |
for areas "outside" the pattern's natural area, |
| 731 |
(for example, outside the surface bounds or outside the gradient geometry). |
| 732 |
|
| 733 |
Mesh patterns are not affected by the extend mode. |
| 734 |
|
| 735 |
The default extend mode is |
| 736 |
:obj:`EXTEND_NONE` for :class:`SurfacePattern` |
| 737 |
and :obj:`EXTEND_PAD` for :class:`Gradient` patterns. |
| 738 |
|
| 739 |
New entries may be added in future versions. |
| 740 |
|
| 741 |
|
| 742 |
.. data:: EXTEND_NONE |
| 743 |
|
| 744 |
Pixels outside of the source pattern are fully transparent. |
| 745 |
|
| 746 |
.. data:: EXTEND_REPEAT |
| 747 |
|
| 748 |
The pattern is tiled by repeating. |
| 749 |
|
| 750 |
.. data:: EXTEND_REFLECT |
| 751 |
|
| 752 |
The pattern is tiled by reflecting at the edges. |
| 753 |
|
| 754 |
.. data:: EXTEND_PAD |
| 755 |
|
| 756 |
Pixels outside of the pattern copy the closest pixel from the source. |
| 757 |
|
| 758 |
|
| 759 |
.. _FILTER: |
| 760 |
|
| 761 |
Pixel filter |
| 762 |
------------ |
| 763 |
|
| 764 |
Used to indicate what filtering should be applied |
| 765 |
when reading pixel values from patterns. |
| 766 |
See :meth:`Pattern.set_filter` for indicating the desired filter |
| 767 |
to be used with a particular pattern. |
| 768 |
|
| 769 |
|
| 770 |
.. data:: FILTER_FAST |
| 771 |
|
| 772 |
A high-performance filter, |
| 773 |
with quality similar to :obj:`FILTER_NEAREST`. |
| 774 |
|
| 775 |
.. data:: FILTER_GOOD |
| 776 |
|
| 777 |
A reasonable-performance filter, |
| 778 |
with quality similar to :obj:`FILTER_BILINEAR`. |
| 779 |
|
| 780 |
.. data:: FILTER_BEST |
| 781 |
|
| 782 |
The highest-quality available, |
| 783 |
performance may not be suitable for interactive use. |
| 784 |
|
| 785 |
.. data:: FILTER_NEAREST |
| 786 |
|
| 787 |
Nearest-neighbor filtering. |
| 788 |
|
| 789 |
.. data:: FILTER_BILINEAR |
| 790 |
|
| 791 |
Linear interpolation in two dimensions. |
| 792 |
|
| 793 |
.. data:: FILTER_GAUSSIAN |
| 794 |
|
| 795 |
This filter value is currently unimplemented, |
| 796 |
and should not be used in current code. |
| 797 |
|
| 798 |
|
| 799 |
.. _PDF_VERSION: |
| 800 |
|
| 801 |
PDF version |
| 802 |
----------- |
| 803 |
|
| 804 |
Used to describe the version number of the PDF specification |
| 805 |
that a generated PDF file will conform to. |
| 806 |
|
| 807 |
.. data:: PDF_VERSION_1_4 |
| 808 |
|
| 809 |
The version 1.4 of the PDF specification. |
| 810 |
|
| 811 |
.. data:: PDF_VERSION_1_5 |
| 812 |
|
| 813 |
The version 1.5 of the PDF specification. |
| 814 |
|
| 815 |
|
| 816 |
.. _PDF_OUTLINE: |
| 817 |
|
| 818 |
PDF outline |
| 819 |
----------- |
| 820 |
|
| 821 |
Used to specify the attributes of an outline item. These flags may be |
| 822 |
bitwise-or'd to produce any combination of flags. |
| 823 |
|
| 824 |
*New in cairo 1.16.* |
| 825 |
|
| 826 |
*New in cairocffi 0.9.* |
| 827 |
|
| 828 |
.. data:: PDF_OUTLINE_FLAG_OPEN |
| 829 |
|
| 830 |
The outline item defaults to open in the PDF viewer. |
| 831 |
|
| 832 |
.. data:: PDF_OUTLINE_FLAG_BOLD |
| 833 |
|
| 834 |
The outline item is displayed by the viewer in bold text. |
| 835 |
|
| 836 |
.. data:: PDF_OUTLINE_FLAG_ITALIC |
| 837 |
|
| 838 |
The outline item is displayed by the viewer in italic text. |
| 839 |
|
| 840 |
There's also a constant used to specify the root level for outlines. |
| 841 |
|
| 842 |
.. data:: PDF_OUTLINE_ROOT |
| 843 |
|
| 844 |
Root level for outlines. |
| 845 |
|
| 846 |
|
| 847 |
.. _PDF_METADATA: |
| 848 |
|
| 849 |
PDF metadata |
| 850 |
------------ |
| 851 |
|
| 852 |
Used to specify the metadata to set. |
| 853 |
|
| 854 |
*New in cairo 1.16.* |
| 855 |
|
| 856 |
*New in cairocffi 0.9.* |
| 857 |
|
| 858 |
.. data:: PDF_METADATA_TITLE |
| 859 |
|
| 860 |
The document title. |
| 861 |
|
| 862 |
.. data:: PDF_METADATA_AUTHOR |
| 863 |
|
| 864 |
The document author. |
| 865 |
|
| 866 |
.. data:: PDF_METADATA_SUBJECT |
| 867 |
|
| 868 |
The document subject. |
| 869 |
|
| 870 |
.. data:: PDF_METADATA_KEYWORDS |
| 871 |
|
| 872 |
The document keywords. |
| 873 |
|
| 874 |
.. data:: PDF_METADATA_CREATOR |
| 875 |
|
| 876 |
The document creator. |
| 877 |
|
| 878 |
.. data:: PDF_METADATA_CREATE_DATE |
| 879 |
|
| 880 |
The document creation date. |
| 881 |
|
| 882 |
.. data:: PDF_METADATA_MOD_DATE |
| 883 |
|
| 884 |
The document modification date. |
| 885 |
|
| 886 |
|
| 887 |
.. _PS_LEVEL: |
| 888 |
|
| 889 |
PostScript level |
| 890 |
---------------- |
| 891 |
|
| 892 |
Used to describe the language level of the PostScript Language Reference |
| 893 |
that a generated PostScript file will conform to. |
| 894 |
|
| 895 |
.. data:: PS_LEVEL_2 |
| 896 |
|
| 897 |
The language level 2 of the PostScript specification. |
| 898 |
|
| 899 |
.. data:: PS_LEVEL_3 |
| 900 |
|
| 901 |
The language level 3 of the PostScript specification. |
| 902 |
|
| 903 |
|
| 904 |
.. _SVG_VERSION: |
| 905 |
|
| 906 |
SVG version |
| 907 |
----------- |
| 908 |
|
| 909 |
Used to describe the version number of the SVG specification |
| 910 |
that a generated SVG file will conform to. |
| 911 |
|
| 912 |
.. data:: SVG_VERSION_1_1 |
| 913 |
|
| 914 |
The version 1.1 of the SVG specification. |
| 915 |
|
| 916 |
.. data:: SVG_VERSION_1_2 |
| 917 |
|
| 918 |
The version 1.2 of the SVG specification. |
| 919 |
|
| 920 |
|
| 921 |
.. _SVG_UNIT: |
| 922 |
|
| 923 |
SVG unit |
| 924 |
-------- |
| 925 |
|
| 926 |
Used to describe the units valid for coordinates and lengths in the SVG |
| 927 |
specification. |
| 928 |
|
| 929 |
See also: |
| 930 |
|
| 931 |
- https://www.w3.org/TR/SVG/coords.html#Units |
| 932 |
- https://www.w3.org/TR/SVG/types.html#DataTypeLength |
| 933 |
- https://www.w3.org/TR/css-values-3/#lengths |
| 934 |
|
| 935 |
*New in cairo 1.16.* |
| 936 |
|
| 937 |
*New in cairocffi 0.9.* |
| 938 |
|
| 939 |
.. data:: SVG_UNIT_USER |
| 940 |
|
| 941 |
User unit, a value in the current coordinate system. If used in the root |
| 942 |
element for the initial coordinate systems it corresponds to pixels. |
| 943 |
|
| 944 |
.. data:: SVG_UNIT_EM |
| 945 |
|
| 946 |
The size of the element's font. |
| 947 |
|
| 948 |
.. data:: SVG_UNIT_EX |
| 949 |
|
| 950 |
The x-height of the element’s font. |
| 951 |
|
| 952 |
.. data:: SVG_UNIT_PX |
| 953 |
|
| 954 |
Pixels (1px = 1/96th of 1in). |
| 955 |
|
| 956 |
.. data:: SVG_UNIT_IN |
| 957 |
|
| 958 |
Inches (1in = 2.54cm = 96px). |
| 959 |
|
| 960 |
.. data:: SVG_UNIT_CM |
| 961 |
|
| 962 |
Centimeters (1cm = 96px/2.54). |
| 963 |
|
| 964 |
.. data:: SVG_UNIT_MM |
| 965 |
|
| 966 |
Millimeters (1mm = 1/10th of 1cm). |
| 967 |
|
| 968 |
.. data:: SVG_UNIT_PT |
| 969 |
|
| 970 |
Points (1pt = 1/72th of 1in). |
| 971 |
|
| 972 |
.. data:: SVG_UNIT_PC |
| 973 |
|
| 974 |
Picas (1pc = 1/6th of 1in). |
| 975 |
|
| 976 |
.. data:: SVG_UNIT_PERCENT |
| 977 |
|
| 978 |
Percent, a value that is some fraction of another reference value. |
| 979 |
|
| 980 |
|
| 981 |
.. _cluster-flags: |
| 982 |
|
| 983 |
Cluster flags |
| 984 |
------------- |
| 985 |
|
| 986 |
Specifies properties of a text cluster mapping. |
| 987 |
Flags are integer values representing a bit field. |
| 988 |
|
| 989 |
.. data:: TEXT_CLUSTER_FLAG_BACKWARD |
| 990 |
:annotation: = 0x00000001 |
| 991 |
|
| 992 |
The clusters in the cluster array |
| 993 |
map to glyphs in the glyph array from end to start. (Since 1.8) |