PDF::Font::Loader

Font loading and embedding for the PDF tool-chain

[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

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 .

PDF::Font::Loader v0.7.5

Font loading and embedding for the PDF tool-chain

Authors

  • David Warring

License

Artistic-2.0

Dependencies

Font::AFM:ver<1.24.6+>Font::FreeType:ver<0.4.3+>Hash::intNative::PackingPDF::Content:ver<0.6.12+>PDF::Lite:ver<0.0.11+>PDF:ver<0.5.4+>

Test Dependencies

Provides

  • PDF::Font::Loader
  • PDF::Font::Loader::Dict
  • PDF::Font::Loader::Enc
  • PDF::Font::Loader::Enc::CMap
  • PDF::Font::Loader::Enc::Glyphic
  • PDF::Font::Loader::Enc::Identity16
  • PDF::Font::Loader::Enc::Type1
  • PDF::Font::Loader::Enc::Unicode
  • PDF::Font::Loader::FontObj
  • PDF::Font::Loader::FontObj::CID
  • PDF::Font::Loader::Glyph
  • PDF::Font::Loader::Type1::Stream

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