afm

package
v1.0.11 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package afm implements a decoder for AFM (Adobe Font Metrics) files.

See:

for more informations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CharWidth

type CharWidth struct {
	// contains filtered or unexported fields
}

type Direction

type Direction struct {
	// UnderlinePosition is the distance from the baseline for centering
	// underlining strokes.
	UnderlinePosition fixed.Int16_16

	// UnderlineThickness is the stroke width for underlining.
	UnderlineThickness fixed.Int16_16

	// ItalicAngle is the angle (in degrees counter-clockwise from the vertical)
	// of the dominant vertical stroke of the font.
	ItalicAngle fixed.Int16_16

	// CharWidth is the width vector of this font's program characters.
	CharWidth CharWidth

	// IsFixedPitch indicates whether the program is a fixed pitch (monospace) font.
	IsFixedPitch bool
}

type Font

type Font struct {
	// MetricsSets defines the writing Direction.
	// 0: Direction 0 only.
	// 1: Direction 1 only.
	// 2: both directions.
	MetricsSets int

	FontName   string // FontName is the name of the font program as presented to the PostScript language 'findfont' operator.
	FullName   string // FullName is the full text name of the font.
	FamilyName string // FamilyName is the name of the typeface family to which the font belongs.
	Weight     string // Weight is the Weight of the font (ex: Regular, Bold, Light).
	BBox       bbox   // BBox is the font bounding box.
	Version    string // Version is the font program Version identifier.
	Notice     string // Notice contains the font name trademark or copyright Notice.

	// EncodingScheme specifies the default encoding vector used for this font
	// program (ex: AdobeStandardEncoding, JIS12-88-CFEncoding, ...)
	// Special font program might state FontSpecific.
	EncodingScheme string
	MappingScheme  int
	EscChar        int
	CharacterSet   string // CharacterSet describes the character set (glyph complement) of this font program.
	Characters     int    // Characters describes the number of Characters defined in this font program.
	IsBaseFont     bool   // IsBaseFont indicates whether this font is a base font program.

	IsFixedV  bool // IsFixedV indicates whether vvector is the same for every character in this font.
	IsCIDFont bool // IsCIDFont indicates whether the font is a CID-keyed font.

	CapHeight fixed.Int16_16 // CapHeight is usually the y-value of the top of the capital 'H'.
	XHeight   fixed.Int16_16 // XHeight is typically the y-value of the top of the lowercase 'x'.
	Ascender  fixed.Int16_16 // Ascender is usually the y-value of the top of the lowercase 'd'.
	Descender fixed.Int16_16 // Descender is typically the y-value of the bottom of the lowercase 'p'.
	StdHW     fixed.Int16_16 // StdHW specifies the dominant width of horizontal stems.
	StdVW     fixed.Int16_16 // StdVW specifies the dominant width of vertical stems.

	Direction [3]Direction
	// contains filtered or unexported fields
}

Font is an Adobe Font metrics.

func Parse

func Parse(r io.Reader) (Font, error)

Parse parses an AFM file.

func (Font) GetGlyphAdvance

func (q Font) GetGlyphAdvance(charcode int) int

Jump to

Keyboard shortcuts

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