Rand Stats

NotoFonts-OT

zef:tbrowder

Actions Status Actions Status Actions Status

NAME

NotoFonts-OT - Provides an embedded collection of 10 of Google's Noto OpenType fonts for use in Raku PDF creation.

The 10 fonts closely match 10 of the original Adobe Type 1 fonts but in OTF format, and thousands of glyphs instead of only 256.

Tables 1 and 2 below list several ways to refer to the desired font and get it in one of two forms: a PDF font object or a font path to its location.

There also two ways of accessing the fonts: (1) through a class object or (2) through an exported subroutine. Both ways are illustrated below.

Note that there are many more fonts available, and more weight variations of the 10 fonts may be added here later. Please file an issue if you are interested.

SYNOPSIS

use Test;
use PDF::Font::Loader::HarfBuzz;
use PDF::Font::Loader :load-font;
use PDF::Content;
use PDF::Content::FontObj;
use PDF::Lite;

use NotoFonts-OT;

# Use the provided class to create individual font objects
# of the desired font face:
my $nf = NotoFonts-OT.new;

# Now the $nf object can provide the desired loaded fonts
# using C<$nf.get-font: X> where X is any of the code
# references in Tables 1 and 2 below.

# Select the Noto font 'NotoSerif-Regular' to be loaded
# as a PDF font object to be used to print text on a PDF page.
# Use a code reference from Table 1:
my $font = $nf.get-font: 1;
isa-ok $font, PDF::Content::FontObj;
# OUTPUT:
ok 1 - The object is-a 'PDF::Content::FontObj'
1..1

That font object, $font, should be able to be used by all the Raku PDF modules requiring a font object. File an issue if you find a problem.

DESCRIPTION

The following tables show the font family name, weight, and slant of the 10 fonts approximating the original Adobe Type 1 fonts. The desired font can be selected by using the appropriate Name, Code, Code2, or Reference Number as the input to class method get-font which returns a PDF font object.

One can also get the font path by using class method get-path.

Note the names and codes are not case sensitive.

Table 1

The Noto Fonts Collection
Noto Font NameCodeCode2Reference No.
NotoSerif-Regularset1
NotoSerif-Boldsebtb2
NotoSerif-Italicseiti3
NotoSerif-BoldItalicsebitbi4
NotoSans-Regularsah5
NotoSans-Boldsabhb6
NotoSans-Italicsaiho7
NotoSans-BoldItalicsabihbo8
NotoSansMono-Regularmc9
NotoSansMono-Boldmbcb10

Table 2

The Equivalent Adobe Type 1 Fonts
Adobe Type 1 NameCodeCode2Reference No.
Timesset1
Times-Boldsebtb2
Times-Italicseiti3
Times-BoldItalicsebitbi4
Helveticasah5
Helvetica-Boldsabhb6
Helvetica-Obliquesaiho7
Helvetica-BoldObliquesabihbo8
Couriermc9
Courier-Boldmbcb10

Alternative use by subroutine

The font or font path can also be obtained with a subroutine if need be. To do that you must only use one child module alone: NotoFonts-OT::FontPaths. For example:

use Test;
use PDF::Font::Loader::HarfBuzz;
use PDF::Font::Loader :load-font;
use PDF::Content;
use PDF::Content::FontObj;
use PDF::Lite;

use NotoFonts-OT::FontPaths;

# Select the Noto font 'NotoSerif-Regular' to be loaded
# as a PDF font object to be used to print text on a PDF page.
# Use a code reference from Table 1:
my $font-obj = get-loaded-font 1;
isa-ok $font, PDF::Content::FontObj;
# OUTPUT:
ok 1 - The object is-a 'PDF::Content::FontObj'
1..1

# You may need to provide a font path:
my $font-path = get-font-path 1;
isa-ok $font-path, IO::Path;
# OUTPUT:
ok 1 - The object is-a 'IO::Path'
1..1

Font sources

The /resouurces directory contains the embedded fonts along with a description of their original source and a list of their sha256sums for authentication.

It also contains a file describing the SIL Open Font License (OFL) font licence for the included fonts and a file with a large amount of Frequently Asked Questions (FAQ) about the OFL.

In the /sbin directory is a Raku script to calculate sha256sums of files.

Package App::FontSample

Use that Raku package to produce font samples in various formats.

AUTHOR

Tom Browder tbrowder@acm.org

COPYRIGHT AND LICENSE

© 2026 Tom Browder

This library is free software; you may redistribute it or modify it under the Artistic License 2.0.