Font::FreeType

read font files and render glyphs from Raku using FreeType2

[Raku PDF Project] / [Font-FreeType Module]

module Font-FreeType-raku - Raku FreeType2 (font library) bindings

Classes in this Distribution

Synopsis

use Font::FreeType;

my Font::FreeType $freetype .= new;
my $face = $freetype.face('t/fonts/Vera.ttf');

$face.set-char-size(24, 24, 100, 100);
for $face.glyph-images('ABC') {
    my $outline = .outline;
    my $bitmap = .bitmap;
    # ...
}

Description

This module allows Raku programs to conveniently read information from font files. All the font access is done through the FreeType2 library, which supports many formats. It can render images of characters with high-quality hinting and anti-aliasing, extract metrics information, and extract the outlines of characters in scalable formats like TrueType.

Please see Font::FreeType.

Scripts

font-say

font-say [--resolution=<Int>] [--pixels=<Int] [--kern] [--hint] [--ascend=<Int>] [--descend=<Int>] [--char-spacing=<Int>] [--word-spacing=<Int>] [--bold=<Int>] [--mode=<Mode> (lcd lcd-v light mono normal)] [--verbose] <font-file> <text>

This script displays text as bitmapped characters, using a given font. For example:

% bin/font-say --hint --pixels=14 t/fonts/Vera.ttf 'FreeType!'
#######                            ##########                              ##
##                                     ##                                  ##
##      #####   ######    ######       ##    ###   ##  #######    ######   ##
##      ####    #######   #######      ##    ###  ###  #######    #######  ##
######  ##     ###   ##  ###   ##      ##     ##  ###  ##   ##   ###   ##  ##
##      ##     ########  ########      ##     ### ##   ##   ###  ########  ##
##      ##     ###       ###           ##      #####   ##   ###  ###
##      ##     ###       ###           ##      ####    ##   ##   ###
##      ##      #######   #######      ##      ####    #######    #######  ##
##      ##       ######    ######      ##       ###    #######     ######  ##
                                                ##     ##
                                               ###     ##
                                              ###      ##

Install

Font::FreeType depends on the freetype native library, so you must install that prior to using this module.

Debian/Ubuntu Linux

sudo apt-get install freetype6-dev

Alpine Linux

doas apk add freetype-dev

Max OS X

brew update
brew install freetype

To checkout and test this module from the Git repository:

$ git checkout https://github.com/pdf-raku/Font-FreeType-raku.git
$ zef build .  # -OR- raku Build.pm
$ prove -e'raku -I .' -v t

Authors

Geoff Richards [email protected]

Ivan Baidakou [email protected]

David Warring [email protected] (Raku Port)

Copyright

Copyright 2004, Geoff Richards.

Ported from Perl to Raku by David Warring [email protected] Copyright 2017.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

Font::FreeType v0.4.0

read font files and render glyphs from Raku using FreeType2

Authors

  • David Warring

License

Artistic-2.0

Dependencies

Method::Also

Test Dependencies

Provides

  • Font::FreeType
  • Font::FreeType::BBox
  • Font::FreeType::BitMap
  • Font::FreeType::CharMap
  • Font::FreeType::Error
  • Font::FreeType::Face
  • Font::FreeType::Glyph
  • Font::FreeType::GlyphImage
  • Font::FreeType::NamedInfo
  • Font::FreeType::Native
  • Font::FreeType::Native::Defs
  • Font::FreeType::Outline
  • Font::FreeType::Raw
  • Font::FreeType::Raw::Defs
  • Font::FreeType::Raw::TT_Sfnt

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