parser

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: May 17, 2024 License: GPL-3.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsUnsupported

func IsUnsupported(err error) bool

IsUnsupported returns true if the error is a NotSupportedError.

Types

type InvalidFontError

type InvalidFontError struct {
	SubSystem string
	Reason    string
}

InvalidFontError indicates a problem with font data.

func (*InvalidFontError) Error

func (err *InvalidFontError) Error() string

type NotSupportedError

type NotSupportedError struct {
	SubSystem string
	Feature   string
}

NotSupportedError indicates that a font file seems valid but uses a CFF feature which is not supported by this library.

func (*NotSupportedError) Error

func (err *NotSupportedError) Error() string

type Parser

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

Parser allows to read data from an sfnt file.

func New

func New(r ReadSeekSizer) *Parser

New allocates a new Parser.

func (*Parser) Discard

func (p *Parser) Discard(n int) error

Discard skips the next n bytes of input.

func (*Parser) Pos

func (p *Parser) Pos() int64

Pos returns the current reading position within the current region.

func (*Parser) Read

func (p *Parser) Read(buf []byte) (int, error)

Read reads len(buf) bytes of data into buf. It returns the number of bytes read and an error, if any. The error is non-nil if and only if less than len(buf) bytes were read.

func (*Parser) ReadBytes

func (p *Parser) ReadBytes(n int) ([]byte, error)

ReadBytes reads n bytes from the file, starting at the current position. The returned slice points into the internal buffer, slice contents must not be modified by the caller and are only valid until the next call to one of the parser methods.

The read size n must be <= 1024.

func (*Parser) ReadInt16

func (p *Parser) ReadInt16() (int16, error)

ReadInt16 reads a single int16 value from the current position.

func (*Parser) ReadUint16

func (p *Parser) ReadUint16() (uint16, error)

ReadUint16 reads a single uint16 value from the current position.

func (*Parser) ReadUint16Slice

func (p *Parser) ReadUint16Slice() ([]uint16, error)

ReadUint16Slice reads a length followed by a sequence of uint16 values.

func (*Parser) ReadUint32

func (p *Parser) ReadUint32() (uint32, error)

ReadUint32 reads a single uint32 value from the current position.

func (*Parser) ReadUint8

func (p *Parser) ReadUint8() (uint8, error)

ReadUint8 reads a single uint8 value from the current position.

func (*Parser) SeekPos

func (p *Parser) SeekPos(filePos int64) error

SeekPos changes the reading position within the current region.

func (*Parser) Size

func (p *Parser) Size() int64

Size returns the total size of the underlying input file.

type ReadSeekSizer

type ReadSeekSizer interface {
	io.ReadSeeker
	Size() int64
}

ReadSeekSizer describes the requirements for a reader that can be used as the input to a Parser.

Jump to

Keyboard shortcuts

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