```{index} single: Cairo::ScaledFont ``` # Cairo::ScaledFont ```{pperl-module-badges} Cairo::ScaledFont ``` ## Functions ### Other Functions #### `create` Creates a scaled font - a font face fixed at one size and transform (cairo_scaled_font_create): `Cairo::ScaledFont->create($face, $font_matrix, $ctm, $options)`. `$font_matrix` sizes and shapes the glyphs, `$ctm` is the transform they will be drawn under, both `Cairo::Matrix`, and `$options` is a `Cairo::FontOptions`. All four arguments are required; a shorter list croaks with a usage message. #### `status` Returns the scaled font's error status as a nickname string, `success` when it is usable. #### `get_type` Returns the backend behind this scaled font as a nickname string: `toy`, `ft`, `win32`, `quartz`, `user` or `dwrite`. Needs libcairo 1.2 or newer. #### `extents` Returns the font's own metrics as a hashref with the keys `ascent`, `descent`, `height`, `max_x_advance` and `max_y_advance`. These describe the font at this size, independent of any particular string. #### `text_extents` Measures a string in this font and returns a hashref with the keys `x_bearing`, `y_bearing`, `width`, `height`, `x_advance` and `y_advance`. The string is taken as UTF-8. It is required; without it the call croaks with a usage message. Needs libcairo 1.2 or newer. #### `get_font_face` Returns the font face this scaled font was made from, blessed into the class matching its backend (`Cairo::ToyFontFace`, `Cairo::FtFontFace`, or the base `Cairo::FontFace`). The face stays valid for as long as you hold it, even if the scaled font goes away. Needs libcairo 1.2 or newer. #### `get_font_matrix` Returns the font matrix the scaled font was created with, as a fresh `Cairo::Matrix`. It is a copy: changing it does not change the scaled font. Needs libcairo 1.2 or newer. #### `get_ctm` Returns the transform matrix the scaled font was created with, as a fresh `Cairo::Matrix`. It is a copy: changing it does not change the scaled font. Needs libcairo 1.2 or newer. #### `get_scale_matrix` Returns the scale matrix - the font matrix combined with the transform - as a fresh `Cairo::Matrix`. It is a copy: changing it does not change the scaled font. Needs libcairo 1.8 or newer. #### `get_font_options` Returns the rendering options the scaled font was created with, as a fresh `Cairo::FontOptions`. It is a separate object: changing it does not change the scaled font. Needs libcairo 1.2 or newer. #### `glyph_extents` Measures a run of glyphs in this font and returns a hashref with the keys `x_bearing`, `y_bearing`, `width`, `height`, `x_advance` and `y_advance`. #### [`text_to_glyphs`](ScaledFont/text_to_glyphs) Converts a string into the glyphs this font would use to draw it, laid out starting at `($x, $y)`: `$sf->text_to_glyphs($x, $y, $utf8)`. ```{toctree} :hidden: :maxdepth: 1 ScaledFont/text_to_glyphs ```