Rendering text
| Chapter 21. Printing |

## Rendering text

Text rendering is done using Pango. The `Pango::Layout` object for printing should be created by calling the `PrintContext::create_pango_layout()` method. The `PrintContext` object also provides the page metrics, via `get_width()` and `get_height()`. The number of pages can be set with `PrintOperation::set_n_pages()`. To actually render the Pango text in `on_draw_page`, get a `Cairo::Context` with `PrintContext::get_cairo_context()` and show the `Pango::LayoutLine`s that appear within the requested page number.

See an example of exactly how this can be done.

Page setup |  | Asynchronous operations