Documentation
¶
Overview ¶
Package font creates and manages PDF font dictionaries and resources.
Index ¶
- Variables
- func CIDFontDescriptor(c context.Context, xRefTable *model.XRefTable, ttf font.TTFLight, ...) (*types.IndirectRef, error)
- func CIDFontDict(c context.Context, xRefTable *model.XRefTable, ttf font.TTFLight, ...) (*types.IndirectRef, error)
- func CIDFontFile(c context.Context, xRefTable *model.XRefTable, fontName string, subFont bool) (*types.IndirectRef, error)
- func CIDSet(xRefTable *model.XRefTable, ttf font.TTFLight, fontName string, ...) (*types.IndirectRef, error)
- func CIDWidths(xRefTable *model.XRefTable, ttf font.TTFLight, fontName string, subFont bool, ...) (*types.IndirectRef, error)
- func CJK(script, lang string) bool
- func CJKEncoding(s string) bool
- func CoreFontDict(xRefTable *model.XRefTable, coreFontName string) (*types.IndirectRef, error)
- func Embedded(xRefTable *model.XRefTable, fontDict types.Dict, objNr int) (bool, error)
- func EnsureCoreFontMetrics(xRefTable *model.XRefTable, d types.Dict) (*types.IndirectRef, error)
- func EnsureFontDict(c context.Context, xRefTable *model.XRefTable, fontName, lang, script string, ...) (*types.IndirectRef, error)
- func FontDescriptor(xRefTable *model.XRefTable, fontDict types.Dict, objNr int) (types.Dict, error)
- func FontResources(c context.Context, xRefTable *model.XRefTable, fm model.FontMap) (types.Dict, error)
- func IndRefsForUserfontUpdate(xRefTable *model.XRefTable, d types.Dict, lang string, ...) error
- func Lang(xRefTable *model.XRefTable, fontDict types.Dict) (string, error)
- func Name(xRefTable *model.XRefTable, fontDict types.Dict, objNumber int) (prefix, fontName string, err error)
- func NewFontDescriptor(c context.Context, xRefTable *model.XRefTable, ttf font.TTFLight, ...) (*types.IndirectRef, error)
- func PDFDocEncoding(xRefTable *model.XRefTable) (*types.IndirectRef, error)
- func RTL(lang string) bool
- func ScriptForEncoding(enc string) string
- func SupportedScript(s string) bool
- func UpdateUserfont(c context.Context, xRefTable *model.XRefTable, fontName string, ...) error
- func UpdateUserfonts(c context.Context, xRefTable *model.XRefTable, ...) error
- func Widths(xRefTable *model.XRefTable, ttf font.TTFLight, first, last int) (*types.IndirectRef, error)
Constants ¶
This section is empty.
Variables ¶
var ( // ErrCorruptFontDict signals a malformed font dictionary. ErrCorruptFontDict = errors.New("corrupt fontDict") )
Functions ¶
func CIDFontDescriptor ¶
func CIDFontDescriptor(c context.Context, xRefTable *model.XRefTable, ttf font.TTFLight, fontName, baseFontName, fontLang string, embed bool) (*types.IndirectRef, error)
CIDFontDescriptor returns a CIDFont descriptor and supports cancellation.
func CIDFontDict ¶
func CIDFontDict(c context.Context, xRefTable *model.XRefTable, ttf font.TTFLight, fontName, baseFontName, lang string, parms *cjk) (*types.IndirectRef, error)
CIDFontDict returns the descendant font dictionary for a Type0 font and supports cancellation.
func CIDFontFile ¶
func CIDFontFile(c context.Context, xRefTable *model.XRefTable, fontName string, subFont bool) (*types.IndirectRef, error)
CIDFontFile returns a TrueType font file or subfont file for fontName and supports cancellation.
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 CJKEncoding ¶
CJKEncoding returns true for supported encodings.
func CoreFontDict ¶ added in v0.12.0
CoreFontDict returns an indirect reference to a Type 1 font.
func Embedded ¶ added in v0.10.0
Embedded returns true if the font represented by fontDict is embedded.
func EnsureCoreFontMetrics ¶ added in v0.16.2
EnsureCoreFontMetrics completes omitted standard-font metrics for PDF 2.0 and returns any new descriptor reference. Complete metrics are preserved; partial metrics and unsupported encodings return an error.
func EnsureFontDict ¶
func EnsureFontDict(c context.Context, xRefTable *model.XRefTable, fontName, lang, script string, field bool, indRef *types.IndirectRef) (*types.IndirectRef, error)
EnsureFontDict ensures a font dictionary for fontName and supports cancellation.
func FontDescriptor ¶
FontDescriptor gets the font descriptor for this font.
func FontResources ¶
func FontResources(c context.Context, xRefTable *model.XRefTable, fm model.FontMap) (types.Dict, error)
FontResources returns a font resource dictionary for a font map and supports cancellation.
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 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 ¶ added in v0.10.0
func NewFontDescriptor(c context.Context, xRefTable *model.XRefTable, ttf font.TTFLight, fontName, fontLang string) (*types.IndirectRef, error)
NewFontDescriptor returns a TrueType font descriptor and supports cancellation.
func PDFDocEncoding ¶ added in v0.7.0
func PDFDocEncoding(xRefTable *model.XRefTable) (*types.IndirectRef, error)
PDFDocEncoding returns an indirect reference to a new PDF doc encoding dict.
func ScriptForEncoding ¶ added in v0.11.0
ScriptForEncoding returns the script for encoding.
func SupportedScript ¶ added in v0.7.0
SupportedScript returns true if s is a supported script.
func UpdateUserfont ¶
func UpdateUserfont(c context.Context, xRefTable *model.XRefTable, fontName string, f model.FontResource) error
UpdateUserfont updates the fontdict for fontName and supports cancellation.
func UpdateUserfonts ¶ added in v0.12.0
func UpdateUserfonts(c context.Context, xRefTable *model.XRefTable, fonts map[string]types.IndirectRef) error
UpdateUserfonts updates referenced fonts and supports cancellation.
Types ¶
This section is empty.