package type1c

import "github.com/benoitkugler/textlayout/fonts/type1C"

Package type1c provides a parser for the CFF font format defined at https://www.adobe.com/content/dam/acom/en/devnet/font/pdfs/5176.CFF.pdf. It can be used to read standalone CFF font files, but is mainly used through the truetype package to read embedded CFF glyph tables.

Index

Types

type Font

type Font struct {
	Encoding *simpleencodings.Encoding

	fonts.PSInfo
	// contains filtered or unexported fields
}

Font represents a parsed Font font.

func Load

func Load(file fonts.Resource) ([]Font, error)

Load reads standalone .cff font files and may return multiple fonts.

func Parse

func Parse(file fonts.Resource) (*Font, error)

Parse parse a .cff font file. Although CFF enables multiple font or CIDFont programs to be bundled together in a single file, embedded CFF font file in PDF or in TrueType/OpenType fonts shall consist of exactly one font or CIDFont. Thus, this function returns an error if the file contains more than one font. See Loader to read standalone .cff files

func (*Font) Cmap

func (f *Font) Cmap() (fonts.Cmap, fonts.CmapEncoding)

func (*Font) GlyphName

func (f *Font) GlyphName(glyph fonts.GID) string

GlyphName returns the name of the glyph or an empty string if not found.

func (*Font) LoadGlyph

func (f *Font) LoadGlyph(glyph fonts.GID) ([]fonts.Segment, ps.PathBounds, error)

LoadGlyph parses the glyph charstring to compute segments and path bounds. It returns an error if the glyph is invalid or if decoding the charstring fails.

func (*Font) LoadSummary

func (f *Font) LoadSummary() (fonts.FontSummary, error)

func (*Font) NumGlyphs

func (f *Font) NumGlyphs() int

NumGlyphs returns the number of glyphs in this font. It is also the maximum glyph index + 1.

func (*Font) PoscriptName

func (f *Font) PoscriptName() string

func (*Font) PostscriptInfo

func (f *Font) PostscriptInfo() (fonts.PSInfo, bool)

Source Files

cff.go charsets.go charstring.go encodings.go parser.go

Version
v0.3.1 (latest)
Published
Nov 14, 2024
Platform
linux/amd64
Imports
10 packages
Last checked
5 days ago

Tools for package owners.