coverage

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: 5 Imported by: 0

Documentation

Overview

Package coverage reads and writes OpenType "Coverage Tables". https://docs.microsoft.com/en-us/typography/opentype/spec/chapter2#coverage-table

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Set

type Set map[glyph.ID]bool

Set is a coverage table, but with the coverage indices omitted.

func ReadSet

func ReadSet(p *parser.Parser, pos int64) (Set, error)

ReadSet reads a coverage table from a parser. This function allows for some duplicate glyphs to be included. This is forbidden by the spec, but occurs in some widely used fonts.

func (Set) Glyphs

func (set Set) Glyphs() []glyph.ID

Glyphs returned the glyphs covered by the Set, in order of increasing glyph ID.

func (Set) ToTable

func (set Set) ToTable() Table

ToTable converts the Set to a Coverage table.

type Table

type Table map[glyph.ID]int

Table represents an OpenType "Coverage Table". A Coverage table defines a unique index value, the Coverage Index, for each covered glyph. The Coverage Indexes are sequential, from 0 to the number of covered glyphs minus 1. The map from glyph ID to Coverage Index must be strictly monotonic.

func Read

func Read(p *parser.Parser, pos int64) (Table, error)

Read reads a coverage table from the given parser.

func (Table) Contains

func (table Table) Contains(gid glyph.ID) bool

Contains returns true if the given glyph ID is covered by the table.

func (Table) Encode

func (table Table) Encode() []byte

Encode returns the binary representation of the coverage table.

func (Table) EncodeLen

func (table Table) EncodeLen() int

EncodeLen returns the number of bytes in the binary representation of the coverage table.

func (Table) Glyphs

func (table Table) Glyphs() []glyph.ID

Glyphs returns the glyphs covered by the table in increasing order.

func (Table) Prune

func (table Table) Prune(size int)

Prune removes all glyphs from the table that have coverage index >= size.

func (Table) ToSet added in v0.3.5

func (table Table) ToSet() Set

Jump to

Keyboard shortcuts

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