MCPcopy Create free account
hub / github.com/tdewolff/canvas / Decode

Method Decode

cmd/pdftext/encoding.go:92–105  ·  view source on GitHub ↗
(b []byte)

Source from the content-addressed store, hash-verified

90}
91
92func (e builtinEncoding) Decode(b []byte) ([]byte, error) {
93 runes := []rune{}
94 if e.bytes == 1 {
95 for _, c := range b {
96 runes = append(runes, e.sfnt.Cmap.ToUnicode(uint16(c))...)
97 }
98 } else {
99 for i := 0; i+2 <= len(b); i += 2 {
100 c := binary.BigEndian.Uint16(b[i : i+2])
101 runes = append(runes, e.sfnt.Cmap.ToUnicode(c)...)
102 }
103 }
104 return []byte(string(runes)), nil
105}
106
107type pdfFont interface {
108 Bytes() int

Callers

nothing calls this directly

Calls 1

ToUnicodeMethod · 0.65

Tested by

no test coverage detected