package cffimport ()//go:generate ../../../../../typesetting-utils/generators/binarygen/cmd/generator . _src.gotype header2 struct { majorVersion uint8// Format major version. Set to 2. minorVersion uint8// Format minor version. Set to zero. headerSize uint8// Header size (bytes). topDictLength uint16// Length of Top DICT structure in bytes.}type indexStart struct { count uint32// Number of objects stored in INDEX offSize uint8// Offset array element size// then // offset []Offset // data []byte}//lint:ignore U1000 this type is required so that the code generator add a ParseFdSelect functiontype dummy struct { fd fdSelect}// fdSelect holds a CFF font's Font Dict Select data.type fdSelect interface { isFdSelect() fontDictIndex(glyph tables.GlyphID) (byte, error)// return the maximum index + 1 (it's the length of an array // which can be safely indexed by the indexes) extent() int}func (fdSelect0) () {}func (fdSelect3) () {}func (fdSelect4) () {}type fdSelect0 struct { format uint8`unionTag:"0"`// Set to 0 fds []uint8// [nGlyphs] FD selector array}var errGlyph = errors.New("invalid glyph index")func ( fdSelect0) ( tables.GlyphID) (byte, error) {ifint() >= len(.fds) {return0, errGlyph }return .fds[], nil}func ( fdSelect0) () int { := -1for , := range .fds {ifint() > { = int() } }return + 1}type fdSelect3 struct { format uint8`unionTag:"3"`// Set to 3 nRanges uint16// Number of ranges ranges []range3`arrayCount:"ComputedField-nRanges"`// [nRanges] Array of Range3 records (see below) sentinel uint16// Sentinel GID}type range3 struct { first tables.GlyphID// First glyph index in range fd uint8// FD index for all glyphs in range}func ( fdSelect3) ( tables.GlyphID) (byte, error) { , := 0, len(.ranges)for < { := ( + ) / 2 := .ranges[] := .firstif < { = continue } := .sentinelif < len(.ranges)-1 { = .ranges[+1].first }if <= { = + 1continue }return .fd, nil }return0, errGlyph}func ( fdSelect3) () int { := -1for , := range .ranges {ifint(.fd) > { = int(.fd) } }return + 1}type fdSelect4 struct { format uint8`unionTag:"4"`// Set to 4 nRanges uint32// Number of ranges ranges []range4`arrayCount:"ComputedField-nRanges"`// [nRanges] Array of Range4 records (see below) sentinel uint32// Sentinel GID}type range4 struct { first uint32// First glyph index in range fd uint16// FD index for all glyphs in range}func ( fdSelect4) ( tables.GlyphID) (byte, error) { , := .fontDictIndex32(uint32())returnbyte(), }func ( fdSelect4) ( uint32) (uint16, error) { , := 0, len(.ranges)for < { := ( + ) / 2 := .ranges[] := .firstif < { = continue } := .sentinelif < len(.ranges)-1 { = .ranges[+1].first }if <= { = + 1continue }return .fd, nil }return0, errGlyph}func ( fdSelect4) () int { := -1for , := range .ranges {ifint(.fd) > { = int(.fd) } }return + 1}
The pages are generated with Goldsv0.8.7. (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds.