Glyph

[Raku PDF Project] / [PDF-Font-Loader Module] / PDF::Font::Loader :: Glyph

class PDF::Font::Loader::Glyph

Represents a single glyph in a PDF

Description

This is an introspective class for looking up glyphs from font encodings.

Example

use PDF::Font::Loader::Glyph;

# load from character encodings
my PDF::Font::Loader::Glyph @glyphs = $font.glyphs: "Hi";
say @glyphs[0].raku; # Glyph.new(:name<H>, :code-point(72),  :cid(48), :gid(26), :ax(823), :ay(0))
say @glyphs[1].raku; # Glyph.new(:name<i>, :code-point(105), :cid(4),  :gid(21), :ax(334), :ay(0)

# load from CIDs
@glyphs = $font.glyphs: [48, 4];

Methods

code-point

The Unicode code-point for the glyph.

If the font has been loaded from a PDF dictionary. The glyph may not have a Unicode font mapping. In this case, code-point will be zero.

name

Glyph name.

cid

The PDF logical character identifier for the glyph

gid

Actual glyph identifier for the glyph. This is the index into the font's associated face object.

For Identity-H and Identity-V encoded fonts and other fonts without a cid-to-gid-map table, the gid will be the same as the cid.

ax

The width (horizontal displacement to the next glyph). The value should be multiplied by font-size / 1000 to compute the actual displacement.

Note that the width of a glyph can be indirectly set or altered via the font object:

$font.glyph-width('i') -= 100

ay

The height (vertical displacement to the next glyph) for a vertically written glyph. This method is not-yet-implemented, and always returns zero.

sx

The actual width of the glyph in the current font. This may vary from ax if a width has been set for the glyph, or when a font has been substituted while loading an unembedded or core font from a PDF dictionary.

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.