index

[Raku HarfBuzz Project] / [HarfBuzz-Shaper-Cairo Module]

class HarfBuzz::Shaper::Cairo

HarfBuzz / Cairo shaping integration

Synopsis

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 Font::FreeType;
use Font::FreeType::Face;
use HarfBuzz::Font::FreeType;
my Font::FreeType::Face $ft-face = Font::FreeType.face: $file;
my HarfBuzz::Font::FreeType() $font = %( :$ft-face );
my HarfBuzz::Shaper::Cairo $shaper3 .= new: :$font, :buf{:$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.

Methods

method cairo-glyphs

method cairo-glyphs(
    Numeric :x($x0) = 0e0,
    Numeric :y($y0) = 0e0,
    |c
) 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

HarfBuzz::Shaper::Cairo v0.0.5

Cairo integeration for the HarfBuzz font shaping library

Authors

  • David Warring

License

Artistic-2.0

Dependencies

HarfBuzz:ver<0.0.11+>HarfBuzz::Font::FreeType:ver<0.0.5+>Cairo:ver<0.2.7+>

Test Dependencies

Provides

  • HarfBuzz::Font::Cairo
  • HarfBuzz::Shaper::Cairo

The Camelia image is copyright 2009 by Larry Wall. "Raku" is trademark of the Yet Another Society. All rights reserved.