Function pangocairo::prelude::functions::create_layout
source · pub fn create_layout(cr: &Context) -> Option<Layout>
Expand description
Creates a layout object set up to match the current transformation and target surface of the Cairo context.
This layout can then be used for text measurement with functions
like [methodPango
.get_size] or drawing with functions like
[funcshow_layout
]. If you change the transformation or target
surface for cr
, you need to call [funcupdate_layout
].
This function is the most convenient way to use Cairo with Pango,
however it is slightly inefficient since it creates a separate
pango::Context
object for each layout. This might matter in an
application that was laying out large amounts of text.
cr
a Cairo context
Returns
the newly created pango::Layout