Help language development. Donate to The Perl Foundation

HarfBuzz::Shaper::Cairo cpan:WARRINGD last updated on 2022-02-14
[[Raku HarfBuzz Project]](
 / [[HarfBuzz-Shaper-Cairo Module]](

class HarfBuzz::Shaper::Cairo

HarfBuzz / Cairo shaping integration


    use HarfBuzz::Shaper::Cairo :&cairo-glyphs;
    use HarfBuzz::Shaper;
    use Cairo;
    my Cairo::Glyphs $glyphs;
    my $file = 't/fonts/NimbusRoman-Regular.otf';
    my $text = 'Hell€!';
    # -- functional interface --
    my HarfBuzz::Shaper $shaper .= new: :font{:$file}, :buf{:$text};
    $glyphs = cairo-glyphs($shaper);
    # -- OO interface --
    my HarfBuzz::Shaper::Cairo $shaper2 .= new: :font{:$file}, :buf{:$text};
    $glyphs = $shaper2.cairo-glyphs;
    # -- FreeType integration --
    use HarfBuzz::Font::Cairo;
    my HarfBuzz::Font::Cairo $font .= new: :$file'
    my HarfBuzz::Shaper::Cairo $shaper3 = $font.shaper: {:$text};
    $glyphs = $shaper3.cairo-glyphs;

### Description

This module compiles a set of shaped glyphs into a Cairo::Glyphs object; suitable for use by the Cairo::Context `show_glyphs()` and `glyph_path()` methods.

Please see the `examples/` folder, for a full working example.


### method cairo-glyphs

method cairo-glyphs(
    Numeric :x($x0) = 0e0,
    Numeric :y($y0) = 0e0,
) returns Cairo::Glyphs

Return a set of Cairo compatible shaped glyphs

The returned object is typically passed to either the Cairo::Context show_glyphs() or glyph_path() methods