MCPcopy
hub / github.com/tdewolff/canvas / Encode

Method Encode

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

Source from the content-addressed store, hash-verified

74}
75
76func (e builtinEncoding) Encode(b []byte) ([]byte, error) {
77 s := []byte{}
78 for _, r := range string(b) {
79 gid := e.sfnt.Cmap.Get(r)
80 if e.bytes == 1 {
81 if 256 <= gid {
82 return nil, fmt.Errorf("invalid GID %v for character '%v' (0x%X)\n", gid, string(r), r)
83 }
84 s = append(s, byte(gid))
85 } else {
86 s = binary.BigEndian.AppendUint16(s, gid)
87 }
88 }
89 return s, nil
90}
91
92func (e builtinEncoding) Decode(b []byte) ([]byte, error) {
93 runes := []rune{}

Callers

nothing calls this directly

Calls 1

GetMethod · 0.65

Tested by

no test coverage detected