PDF::Font::Loader
[Raku PDF Project] / [PDF-Font-Loader Module]
Name
PDF::Font::Loader
Synopsis
# load a font from a file
use PDF::Font::Loader :load-font;
use PDF::Content::FontObj;
my PDF::Content::FontObj $deja;
$deja = PDF::Font::Loader.load-font: :file<t/fonts/DejaVuSans.ttf>;
-- or --
$deja = load-font( :file<t/fonts/DejaVuSans.ttf> );
# find/load the best matching system font
# *** requires FontConfig ***
use PDF::Font::Loader :load-font, :find-font;
my Str $file = find-font( :family<DejaVu>, :slant<italic> );
my PDF::Content::FontObj $deja-vu = load-font: :$file;
# use the font to add text to a PDF
use PDF::Lite;
my PDF::Lite $pdf .= new;
$pdf.add-page.text: {
.font = $deja;
.text-position = [10, 600];
.say: 'Hello, world';
}
$pdf.save-as: "/tmp/example.pdf";
Description
This module provides font loading and handling for PDF::Lite, PDF::API6 and other PDF modules.
Classes in this distribution
PDF::Font::Loader - external font loader
PDF::Font::Loader::Dict - PDF font dictionary loader
PDF::Font::Loader::FontObj - Loaded basic font representation
PDF::Font::Loader::FontObj::CID - Loaded CID font representation
PDF::Font::Loader::Enc - Font encoder/decoder base class
PDF::Font::Loader::Enc::Type1 - Typical type-1 encodings (win mac std)
PDF::Font::Loader::Enc::Identity16 - Identity-H/Identity-V 2 byte encoding
PDF::Font::Loader::Enc::CMAP - General CMap driven variable encoding
PDF::Font::Loader::Enc::Unicode - UTF-8, UTF-16 and UTF-32 specific encoding
PDF::Font::Loader::Glyph - Glyph representation class
Install
PDF::Font::Loader depends on:
Font::FreeType Raku module which further depends on the freetype library, so you must install that prior to installing this module.
The find-font
method requires installation of the FontConfig library .