github.com/unidoc/unidoc@v2.2.0+incompatible/pdf/model/textencoding/encoder.go (about)

     1  /*
     2   * This file is subject to the terms and conditions defined in
     3   * file 'LICENSE.md', which is part of this source code package.
     4   */
     5  
     6  package textencoding
     7  
     8  import "github.com/unidoc/unidoc/pdf/core"
     9  
    10  type TextEncoder interface {
    11  	// Convert a raw utf8 string (series of runes) to an encoded string (series of character codes) to be used in PDF.
    12  	Encode(raw string) string
    13  
    14  	// Conversion between character code and glyph name.
    15  	// The bool return flag is true if there was a match, and false otherwise.
    16  	CharcodeToGlyph(code byte) (string, bool)
    17  
    18  	// Conversion between glyph name and character code.
    19  	// The bool return flag is true if there was a match, and false otherwise.
    20  	GlyphToCharcode(glyph string) (byte, bool)
    21  
    22  	// Convert rune to character code.
    23  	// The bool return flag is true if there was a match, and false otherwise.
    24  	RuneToCharcode(val rune) (byte, bool)
    25  
    26  	// Convert character code to rune.
    27  	// The bool return flag is true if there was a match, and false otherwise.
    28  	CharcodeToRune(charcode byte) (rune, bool)
    29  
    30  	// Convert rune to glyph name.
    31  	// The bool return flag is true if there was a match, and false otherwise.
    32  	RuneToGlyph(val rune) (string, bool)
    33  
    34  	// Convert glyph to rune.
    35  	// The bool return flag is true if there was a match, and false otherwise.
    36  	GlyphToRune(glyph string) (rune, bool)
    37  
    38  	ToPdfObject() core.PdfObject
    39  }