font

package
v0.13.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 16, 2026 License: Apache-2.0 Imports: 16 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrCorruptFontDict = errors.New("pdfcpu: corrupt fontDict")
)

Functions

func CIDFontDescriptor

func CIDFontDescriptor(xRefTable *model.XRefTable, ttf font.TTFLight, fontName, baseFontName, fontLang string, embed bool) (*types.IndirectRef, error)

CIDFontDescriptor returns a font descriptor describing the CIDFont’s default metrics other than its glyph widths.

func CIDFontDict

func CIDFontDict(xRefTable *model.XRefTable, ttf font.TTFLight, fontName, baseFontName, lang string, parms *cjk) (*types.IndirectRef, error)

CIDFontDict returns the descendant font dict with special encoding for Type0 fonts.

func CIDFontFile

func CIDFontFile(xRefTable *model.XRefTable, fontName string, subFont bool) (*types.IndirectRef, error)

CIDFontFile returns a TrueType font file or subfont file for fontName.

func CIDSet

func CIDSet(xRefTable *model.XRefTable, ttf font.TTFLight, fontName string, indRef *types.IndirectRef) (*types.IndirectRef, error)

CIDSet computes a CIDSet for used glyphs and updates or returns a new object.

func CIDWidths

func CIDWidths(xRefTable *model.XRefTable, ttf font.TTFLight, fontName string, subFont bool, indRef *types.IndirectRef) (*types.IndirectRef, error)

CIDWidths returns the value for W in a CIDFontDict.

func CJK

func CJK(script, lang string) bool

CJK returns true if script and lang imply a CJK font.

func CJKEncoding

func CJKEncoding(s string) bool

CJKEncoding returns true for supported encodings.

func CoreFontDict

func CoreFontDict(xRefTable *model.XRefTable, coreFontName string) (*types.IndirectRef, error)

CoreFontDict returns an indirect reference to a Type 1 font.

func Embedded

func Embedded(xRefTable *model.XRefTable, fontDict types.Dict, objNr int) (bool, error)

Embedded returns true if the font represented by fontDict is embedded.

func EnsureFontDict

func EnsureFontDict(xRefTable *model.XRefTable, fontName, lang, script string, field bool, indRef *types.IndirectRef) (*types.IndirectRef, error)

EnsureFontDict ensures a font dict for fontName, lang, script.

func FontDescriptor

func FontDescriptor(xRefTable *model.XRefTable, fontDict types.Dict, objNr int) (types.Dict, error)

FontDescriptor gets the font descriptor for this font.

func FontResources

func FontResources(xRefTable *model.XRefTable, fm model.FontMap) (types.Dict, error)

FontResources returns a font resource dict for a font map.

func IndRefsForUserfontUpdate

func IndRefsForUserfontUpdate(xRefTable *model.XRefTable, d types.Dict, lang string, font *model.FontResource) error

IndRefsForUserfontUpdate detects used indirect references for a possible user font update.

func Lang

func Lang(xRefTable *model.XRefTable, fontDict types.Dict) (string, error)

Lang detects the optional language indicator in a font dict.

func Name

func Name(xRefTable *model.XRefTable, fontDict types.Dict, objNumber int) (prefix, fontName string, err error)

Name evaluates the font name for a given font dict.

func NewFontDescriptor

func NewFontDescriptor(xRefTable *model.XRefTable, ttf font.TTFLight, fontName, fontLang string) (*types.IndirectRef, error)

NewFontDescriptor returns a TrueType font descriptor describing font’s default metrics other than its glyph widths.

func PDFDocEncoding

func PDFDocEncoding(xRefTable *model.XRefTable) (*types.IndirectRef, error)

PDFDocEncoding returns an indirect reference to a new PDF doc encoding dict.

func RTL

func RTL(lang string) bool

RTL returns true if lang implies a right-to-left script.

func ScriptForEncoding

func ScriptForEncoding(enc string) string

ScriptForEncoding returns the script for encoding.

func SupportedScript

func SupportedScript(s string) bool

SupportedScript returns true if s is a supported script.

func UpdateUserfont

func UpdateUserfont(xRefTable *model.XRefTable, fontName string, f model.FontResource) error

UpdateUserfont updates the fontdict for fontName via supplied font resource.

func UpdateUserfonts

func UpdateUserfonts(xRefTable *model.XRefTable, fonts map[string]types.IndirectRef) error

UpdateUserfonts updates referenced fonts.

func Widths

func Widths(xRefTable *model.XRefTable, ttf font.TTFLight, first, last int) (*types.IndirectRef, error)

Widths returns the value for Widths in a TrueType FontDict.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL