dvi

package
Version: v0.4.0 Latest Latest
Warning

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

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

Documentation

Overview

Package dvi implements encoding and decoding DVI documents.

More informations about the DVI standard can be found here:

- https://ctan.crest.fr/tex-archive/dviware/driv-standard/level-0/dvistd0.pdf

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Dump

func Dump(r io.Reader, f func(cmd Cmd) error) error

Dump reads r until EOF and calls f for each decoded DVI command.

Types

type Cmd

type Cmd interface {
	Name() string
	// contains filtered or unexported methods
}

Cmd is a DVI command.

type CmdBOP

type CmdBOP struct {
	C0   int32 `json:"c0"`
	C1   int32 `json:"c1"`
	C2   int32 `json:"c2"`
	C3   int32 `json:"c3"`
	C4   int32 `json:"c4"`
	C5   int32 `json:"c5"`
	C6   int32 `json:"c6"`
	C7   int32 `json:"c7"`
	C8   int32 `json:"c8"`
	C9   int32 `json:"c9"`
	Prev int32 `json:"prev"`
}

func (CmdBOP) Name

func (CmdBOP) Name() string

type CmdDown1

type CmdDown1 struct {
	Value int32 `json:"v"`
}

func (CmdDown1) Name

func (CmdDown1) Name() string

type CmdDown2

type CmdDown2 struct {
	Value int32 `json:"v"`
}

func (CmdDown2) Name

func (CmdDown2) Name() string

type CmdDown3

type CmdDown3 struct {
	Value int32 `json:"v"`
}

func (CmdDown3) Name

func (CmdDown3) Name() string

type CmdDown4

type CmdDown4 struct {
	Value int32 `json:"v"`
}

func (CmdDown4) Name

func (CmdDown4) Name() string

type CmdEOP

type CmdEOP struct{}

func (CmdEOP) Name

func (CmdEOP) Name() string

type CmdFnt1

type CmdFnt1 struct {
	ID uint32
}

func (CmdFnt1) Name

func (CmdFnt1) Name() string

type CmdFnt2

type CmdFnt2 struct {
	ID uint32
}

func (CmdFnt2) Name

func (CmdFnt2) Name() string

type CmdFnt3

type CmdFnt3 struct {
	ID uint32
}

func (CmdFnt3) Name

func (CmdFnt3) Name() string

type CmdFnt4

type CmdFnt4 struct {
	ID int32
}

func (CmdFnt4) Name

func (CmdFnt4) Name() string

type CmdFntDef1

type CmdFntDef1 struct {
	ID       uint8  `json:"id"`
	Checksum uint32 `json:"chksum"`
	Size     int32  `json:"size"`
	Design   int32  `json:"dsize"`
	Area     string `json:"area"`
	Font     string `json:"name"`
}

func (CmdFntDef1) Name

func (CmdFntDef1) Name() string

type CmdFntDef2

type CmdFntDef2 struct {
	ID       uint16 `json:"id"`
	Checksum uint32 `json:"chksum"`
	Size     int32  `json:"size"`
	Design   int32  `json:"dsize"`
	Area     string `json:"area"`
	Font     string `json:"name"`
}

func (CmdFntDef2) Name

func (CmdFntDef2) Name() string

type CmdFntDef3

type CmdFntDef3 struct {
	ID       uint32 `json:"id"`
	Checksum uint32 `json:"chksum"`
	Size     int32  `json:"size"`
	Design   int32  `json:"dsize"`
	Area     string `json:"area"`
	Font     string `json:"name"`
}

func (CmdFntDef3) Name

func (CmdFntDef3) Name() string

type CmdFntDef4

type CmdFntDef4 struct {
	ID       int32  `json:"id"`
	Checksum uint32 `json:"chksum"`
	Size     int32  `json:"size"`
	Design   int32  `json:"dsize"`
	Area     string `json:"area"`
	Font     string `json:"name"`
}

func (CmdFntDef4) Name

func (CmdFntDef4) Name() string

type CmdFntNum

type CmdFntNum struct {
	ID uint8 `json:"-"`
}

func (CmdFntNum) Name

func (cmd CmdFntNum) Name() string

type CmdNOP

type CmdNOP struct{}

func (CmdNOP) Name

func (CmdNOP) Name() string

type CmdPop

type CmdPop struct{}

func (CmdPop) Name

func (CmdPop) Name() string

type CmdPost

type CmdPost struct {
	BOP      uint32 `json:"bop"`
	Num      int32  `json:"num"`
	Den      int32  `json:"den"`
	Mag      int32  `json:"mag"`
	Height   uint32 `json:"height`
	Width    uint32 `json:"width"`
	MaxStack uint16 `json:"max_stack"`
	Pages    uint16 `json:"pages"`
}

func (CmdPost) Name

func (CmdPost) Name() string

type CmdPostPost

type CmdPostPost struct {
	BOP     uint32 `json:"bop"`
	Version uint8  `json:"version"`
	Trailer uint8  `json:"trailer"`
}

func (CmdPostPost) Name

func (CmdPostPost) Name() string

type CmdPre

type CmdPre struct {
	Version uint8  `json:"version"`
	Num     int32  `json:"num"`
	Den     int32  `json:"den"`
	Mag     int32  `json:"mag"`
	Msg     string `json:"msg"`
}

func (CmdPre) Name

func (cmd CmdPre) Name() string

type CmdPush

type CmdPush struct{}

func (CmdPush) Name

func (CmdPush) Name() string

type CmdPut1

type CmdPut1 struct {
	Value uint32 `json:"v"`
}

func (CmdPut1) Name

func (CmdPut1) Name() string

type CmdPut2

type CmdPut2 struct {
	Value uint32 `json:"v"`
}

func (CmdPut2) Name

func (CmdPut2) Name() string

type CmdPut3

type CmdPut3 struct {
	Value uint32 `json:"v"`
}

func (CmdPut3) Name

func (CmdPut3) Name() string

type CmdPut4

type CmdPut4 struct {
	Value int32 `json:"v"`
}

func (CmdPut4) Name

func (CmdPut4) Name() string

type CmdPutRule

type CmdPutRule struct {
	Height int32 `json:"h"`
	Width  int32 `json:"w"`
}

func (CmdPutRule) Name

func (CmdPutRule) Name() string

type CmdRight1

type CmdRight1 struct {
	Value int32 `json:"v"`
}

func (CmdRight1) Name

func (CmdRight1) Name() string

type CmdRight2

type CmdRight2 struct {
	Value int32 `json:"v"`
}

func (CmdRight2) Name

func (CmdRight2) Name() string

type CmdRight3

type CmdRight3 struct {
	Value int32 `json:"v"`
}

func (CmdRight3) Name

func (CmdRight3) Name() string

type CmdRight4

type CmdRight4 struct {
	Value int32 `json:"v"`
}

func (CmdRight4) Name

func (CmdRight4) Name() string

type CmdSet1

type CmdSet1 struct {
	Value uint32 `json:"v"`
}

func (CmdSet1) Name

func (CmdSet1) Name() string

type CmdSet2

type CmdSet2 struct {
	Value uint32 `json:"v"`
}

func (CmdSet2) Name

func (CmdSet2) Name() string

type CmdSet3

type CmdSet3 struct {
	Value uint32 `json:"v"`
}

func (CmdSet3) Name

func (CmdSet3) Name() string

type CmdSet4

type CmdSet4 struct {
	Value int32 `json:"v"`
}

func (CmdSet4) Name

func (CmdSet4) Name() string

type CmdSetChar

type CmdSetChar struct {
	Value uint8 `json:"-"`
}

func (CmdSetChar) Name

func (c CmdSetChar) Name() string

type CmdSetRule

type CmdSetRule struct {
	Height int32 `json:"h"`
	Width  int32 `json:"w"`
}

func (CmdSetRule) Name

func (CmdSetRule) Name() string

type CmdW0

type CmdW0 struct{}

func (CmdW0) Name

func (CmdW0) Name() string

type CmdW1

type CmdW1 struct {
	Value int32 `json:"v"`
}

func (CmdW1) Name

func (CmdW1) Name() string

type CmdW2

type CmdW2 struct {
	Value int32 `json:"v"`
}

func (CmdW2) Name

func (CmdW2) Name() string

type CmdW3

type CmdW3 struct {
	Value int32 `json:"v"`
}

func (CmdW3) Name

func (CmdW3) Name() string

type CmdW4

type CmdW4 struct {
	Value int32 `json:"v"`
}

func (CmdW4) Name

func (CmdW4) Name() string

type CmdX0

type CmdX0 struct{}

func (CmdX0) Name

func (CmdX0) Name() string

type CmdX1

type CmdX1 struct {
	Value int32 `json:"v"`
}

func (CmdX1) Name

func (CmdX1) Name() string

type CmdX2

type CmdX2 struct {
	Value int32 `json:"v"`
}

func (CmdX2) Name

func (CmdX2) Name() string

type CmdX3

type CmdX3 struct {
	Value int32 `json:"v"`
}

func (CmdX3) Name

func (CmdX3) Name() string

type CmdX4

type CmdX4 struct {
	Value int32 `json:"v"`
}

func (CmdX4) Name

func (CmdX4) Name() string

type CmdXXX1

type CmdXXX1 struct {
	Value []byte
}

func (CmdXXX1) Name

func (CmdXXX1) Name() string

type CmdXXX2

type CmdXXX2 struct {
	Value []byte
}

func (CmdXXX2) Name

func (CmdXXX2) Name() string

type CmdXXX3

type CmdXXX3 struct {
	Value []byte
}

func (CmdXXX3) Name

func (CmdXXX3) Name() string

type CmdXXX4

type CmdXXX4 struct {
	Value []byte
}

func (CmdXXX4) Name

func (CmdXXX4) Name() string

type CmdY0

type CmdY0 struct{}

func (CmdY0) Name

func (CmdY0) Name() string

type CmdY1

type CmdY1 struct {
	Value int32 `json:"v"`
}

func (CmdY1) Name

func (CmdY1) Name() string

type CmdY2

type CmdY2 struct {
	Value int32 `json:"v"`
}

func (CmdY2) Name

func (CmdY2) Name() string

type CmdY3

type CmdY3 struct {
	Value int32 `json:"v"`
}

func (CmdY3) Name

func (CmdY3) Name() string

type CmdY4

type CmdY4 struct {
	Value int32 `json:"v"`
}

func (CmdY4) Name

func (CmdY4) Name() string

type CmdZ0

type CmdZ0 struct{}

func (CmdZ0) Name

func (CmdZ0) Name() string

type CmdZ1

type CmdZ1 struct {
	Value int32 `json:"v"`
}

func (CmdZ1) Name

func (CmdZ1) Name() string

type CmdZ2

type CmdZ2 struct {
	Value int32 `json:"v"`
}

func (CmdZ2) Name

func (CmdZ2) Name() string

type CmdZ3

type CmdZ3 struct {
	Value int32 `json:"v"`
}

func (CmdZ3) Name

func (CmdZ3) Name() string

type CmdZ4

type CmdZ4 struct {
	Value int32 `json:"v"`
}

func (CmdZ4) Name

func (CmdZ4) Name() string

type Font

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

Font describes a DVI font, with TeX Font Metrics and its associated font glyph data.

type Machine

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

Machine defines a DVI machine, handling DVI registers and DVI commands.

func NewMachine

func NewMachine(opts ...Option) Machine

NewMachine creates a new DVI machine.

func (*Machine) Run

func (m *Machine) Run(p Program) error

Run executes the whole DVI program on this DVI machine.

type Option

type Option func(cfg *config) error

func WithContext

func WithContext(ctx kpath.Context) Option

func WithLogOutput

func WithLogOutput(w io.Writer) Option

func WithRenderer

func WithRenderer(rdr Renderer) Option

type Program

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

func Compile

func Compile(instr []byte) (Program, error)

type Renderer

type Renderer interface {
	BOP(bop *CmdBOP)
	EOP()

	DrawGlyph(x, y int32, font Font, glyph rune, c color.Color)
	DrawRule(x, y, w, h int32, c color.Color)
}

Renderer defines the protocol to draw a DVI document.

Jump to

Keyboard shortcuts

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