Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Simple = CodeSpaceRange{{[]byte{0x00}, []byte{0xFF}}}
Simple represents the code space range for a simple font. Character codes are one byte long, and correspond directly to the bytes in the PDF string.
var UCS2 = CodeSpaceRange{{[]byte{0x00, 0x00}, []byte{0xFF, 0xFF}}}
UCS2 represents a two-byte encoding. Character codes are two bytes long, and are stored in big-endian order.
Functions ¶
This section is empty.
Types ¶
type CharCode ¶
type CharCode int
CharCode represents a character code within a CodeSpaceRange as a non-negative integer.
TODO(voss): remove
type CodeSpaceRange ¶
type CodeSpaceRange []Range
CodeSpaceRange describes the ranges of byte sequences which are valid character codes for a given encoding.
func (CodeSpaceRange) AllCodes ¶ added in v0.4.0
func (c CodeSpaceRange) AllCodes(s pdf.String) func(yield func(code pdf.String, valid bool) bool) bool
AllCodes returns an iterator over all character codes in the given PDF string.
func (CodeSpaceRange) Decode ¶
func (c CodeSpaceRange) Decode(s pdf.String) (CharCode, int)
Decode decodes the first character code from the given PDF string. It returns the character code and the number of bytes consumed. If the character code cannot be decoded, a code of -1 is returned, and the length is either 0 (if the string is empty) or 1.
TODO(voss): Remove? Otherwise, fix the the number of bytes consumed for invalid codes as described in the PDF spec.