Files
pdfmerge/internal/pdf/model/textencoding/encoder.go
2025-12-15 17:44:00 +01:00

35 lines
1.2 KiB
Go

package textencoding
import "gitea.tecamino.com/paadi/pdfmerge/internal/pdf/core"
type TextEncoder interface {
// Convert a raw utf8 string (series of runes) to an encoded string (series of character codes) to be used in PDF.
Encode(raw string) string
// Conversion between character code and glyph name.
// The bool return flag is true if there was a match, and false otherwise.
CharcodeToGlyph(code byte) (string, bool)
// Conversion between glyph name and character code.
// The bool return flag is true if there was a match, and false otherwise.
GlyphToCharcode(glyph string) (byte, bool)
// Convert rune to character code.
// The bool return flag is true if there was a match, and false otherwise.
RuneToCharcode(val rune) (byte, bool)
// Convert character code to rune.
// The bool return flag is true if there was a match, and false otherwise.
CharcodeToRune(charcode byte) (rune, bool)
// Convert rune to glyph name.
// The bool return flag is true if there was a match, and false otherwise.
RuneToGlyph(val rune) (string, bool)
// Convert glyph to rune.
// The bool return flag is true if there was a match, and false otherwise.
GlyphToRune(glyph string) (rune, bool)
ToPdfObject() core.PdfObject
}