tfm

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2024 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Overview

Package tfm implements a decoder for TFM (TeX Font Metrics) files.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Font

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

Font is a TeX Font metrics.

func Parse

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

Parse parses a TFM file.

func (*Font) Box added in v0.5.0

func (fnt *Font) Box(r rune) (w, h, d fixed.Int12_20, ok bool)

Box returns the width, height and depth of r's glyph.

It returns !ok if the face does not contain a glyph for r.

func (*Font) Checksum added in v0.5.0

func (fnt *Font) Checksum() uint32

Checksum returns the checksum of the TeX font metrics file.

func (*Font) CodingScheme

func (fnt *Font) CodingScheme() string

func (*Font) DesignSize

func (fnt *Font) DesignSize() fixed.Int12_20

func (*Font) GlyphAdvance

func (fnt *Font) GlyphAdvance(r rune) (xfix.Int26_6, bool)

GlyphAdvance returns the advance width of r's glyph.

It returns !ok if the face does not contain a glyph for r.

func (*Font) GlyphBounds added in v0.5.0

func (fnt *Font) GlyphBounds(r rune) (bounds xfix.Rectangle26_6, advance xfix.Int26_6, ok bool)

GlyphBounds returns the bounding box of r's glyph, drawn at a dot equal to the origin, and that glyph's advance width.

It returns !ok if the face does not contain a glyph for r.

The glyph's ascent and descent equal -bounds.Min.Y and +bounds.Max.Y. A visual depiction of what these metrics are is at https://developer.apple.com/library/mac/documentation/TextFonts/Conceptual/CocoaTextArchitecture/Art/glyph_metrics_2x.png

func (*Font) Kern added in v0.5.0

func (fnt *Font) Kern(r0, r1 rune) xfix.Int26_6

Kern returns the horizontal adjustment for the kerning pair (r0, r1). A positive kern means to move the glyphs further apart.

func (*Font) MarshalText

func (fnt *Font) MarshalText() ([]byte, error)

func (*Font) Metrics added in v0.5.0

func (fnt *Font) Metrics() font.Metrics

Metrics returns the metrics for this Face.

func (*Font) Name

func (fnt *Font) Name() string

func (*Font) NumGlyphs

func (fnt *Font) NumGlyphs() int

NumGlyphs returns the number of glyphs in this font.

Jump to

Keyboard shortcuts

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