Documentation ¶
Index ¶
- Variables
- func ExtractRaw(r pdf.Getter, ref pdf.Object) (postscript.Dict, error)
- func IsPredefined(cmap *Info) bool
- func OpenPredefined(name string) (io.ReadCloser, error)
- func ReadRaw(r io.Reader) (postscript.Dict, error)
- type CIDEncoder
- type GIDToCID
- type Info
- func (info *Info) Embed(w pdf.Putter, ref pdf.Reference, other map[string]pdf.Reference) error
- func (info *Info) GetMapping() map[charcode.CharCode]type1.CID
- func (info *Info) IsIdentity() bool
- func (info *Info) MaxCID() type1.CID
- func (info *Info) SetMapping(m map[charcode.CharCode]type1.CID)
- func (info *Info) Write(w io.Writer) error
- type Range
- type SimpleEncoder
- type Single
Constants ¶
This section is empty.
Variables ¶
var AllPredefined = []string{}/* 181 elements not displayed */
Functions ¶
func ExtractRaw ¶ added in v0.3.5
ExtractRaw extract the raw PostScript data of a CMap from a PDF file.
func IsPredefined ¶ added in v0.3.5
func OpenPredefined ¶ added in v0.3.5
func OpenPredefined(name string) (io.ReadCloser, error)
Types ¶
type CIDEncoder ¶
type CIDEncoder interface { // AppendEncoded appends the character code for the given glyph ID // to the given PDF string (allocating new codes as needed). // It also records the fact that the character code corresponds to the // given unicode string. AppendEncoded(pdf.String, glyph.ID, []rune) pdf.String // CMap returns the mapping from character codes to CID values. // This can be used to construct a PDF CMap. CMap() map[charcode.CharCode]type1.CID // ToUnicode returns the mapping from character codes to unicode strings. // This can be used to construct a PDF ToUnicode CMap. ToUnicode() map[charcode.CharCode][]rune // CodeSpaceRange returns the range of character codes // used by this encoder. CodeSpaceRange() charcode.CodeSpaceRange // UsedGIDs is the set of all GIDs which have been used with AppendEncoded. // The returned slice is sorted and always starts with GID 0. UsedGIDs() []glyph.ID }
CIDEncoder constructs and stores mappings from character codes to CID values and from character codes to unicode strings.
func NewIdentityEncoder ¶ added in v0.3.5
func NewIdentityEncoder(g2c GIDToCID) CIDEncoder
NewIdentityEncoder returns an encoder where two-byte codes are used directly as CID values.
func NewUTF8Encoder ¶ added in v0.3.5
func NewUTF8Encoder(g2c GIDToCID) CIDEncoder
NewUTF8Encoder returns an encoder where character codes equal the UTF-8 encoding of the text content, where possible.
type GIDToCID ¶ added in v0.3.5
type GIDToCID interface { CID(glyph.ID) type1.CID ROS() *type1.CIDSystemInfo GIDToCID(numGlyph int) []type1.CID }
GIDToCID encodes a mapping from Glyph Identifier (GID) values to Character Identifier (CID) values.
func NewIdentityGIDToCID ¶ added in v0.3.5
func NewIdentityGIDToCID() GIDToCID
func NewSequentialGIDToCID ¶ added in v0.3.5
func NewSequentialGIDToCID() GIDToCID
NewSequentialGIDToCID returns a GIDToCID which assigns CID values sequentially, starting with 1.
type Info ¶ added in v0.3.3
type Info struct { Name string Version float64 ROS *type1.CIDSystemInfo CS charcode.CodeSpaceRange CSFile charcode.CodeSpaceRange WMode int UseCMap string Singles []Single Ranges []Range Comments bool }
func New ¶ added in v0.3.5
func New(ROS *type1.CIDSystemInfo, cs charcode.CodeSpaceRange, m map[charcode.CharCode]type1.CID) *Info
func (*Info) GetMapping ¶ added in v0.3.5
func (*Info) IsIdentity ¶ added in v0.3.5
IsIdentity returns true if all codes are equal to the corresponding CID.
func (*Info) SetMapping ¶ added in v0.3.5
SetMapping overwrites the mapping information in info with the given mapping.
To make efficient use of range entries, the generated mapping may be a superset of the original mapping, i.e. it may contain entries for charcodes which were not mapped in the original mapping.
type Range ¶ added in v0.3.5
Range describes a range of character codes with consecutive CIDs. First and Last are the first and last code points in the range. Value is the CID of the first code point in the range.
type SimpleEncoder ¶
type SimpleEncoder struct {
// contains filtered or unexported fields
}
SimpleEncoder constructs and stores mappings from one-byte character codes to GID values and from one-byte character codes to unicode strings.
func NewSimpleEncoder ¶
func NewSimpleEncoder() *SimpleEncoder
NewSimpleEncoder allocates a new SimpleEncoder.
func (*SimpleEncoder) AppendEncoded ¶ added in v0.3.5
AppendEncoded appends the character code for the given glyph ID to the given PDF string (allocating new codes as needed). It also records the fact that the character code corresponds to the given unicode string.
func (*SimpleEncoder) Encoding ¶
func (e *SimpleEncoder) Encoding() []glyph.ID
Encoding returns the glyph ID corresponding to each character code.
func (*SimpleEncoder) Overflow ¶
func (e *SimpleEncoder) Overflow() bool
Overflow returns true if the encoder has run out of codes.