Table of Contents

Class Encoding

Namespace
UglyToad.PdfPig.Fonts.Encodings
Assembly
UglyToad.PdfPig.Fonts.dll

Maps character codes to glyph names from a PostScript encoding.

public abstract class Encoding
Inheritance
Encoding
Derived
Inherited Members

Constructors

Encoding()

protected Encoding()

Fields

CodeToName

Mutable code to name map.

protected readonly Dictionary<int, string> CodeToName

Field Value

Dictionary<int, string>

NameToCode

Mutable name to code map.

protected readonly Dictionary<string, int> NameToCode

Field Value

Dictionary<string, int>

Properties

CodeToNameMap

Maps from character codes to names.

public IReadOnlyDictionary<int, string> CodeToNameMap { get; }

Property Value

IReadOnlyDictionary<int, string>

EncodingName

The name of this encoding.

public abstract string EncodingName { get; }

Property Value

string

NameToCodeMap

Maps from names to character cocdes.

public IReadOnlyDictionary<string, int> NameToCodeMap { get; }

Property Value

IReadOnlyDictionary<string, int>

Methods

Add(int, string)

Add a character code and name pair.

protected void Add(int code, string name)

Parameters

code int
name string

ContainsCode(int)

Whether this encoding contains a name for the code.

public bool ContainsCode(int code)

Parameters

code int

Returns

bool

ContainsName(string)

Whether this encoding contains a code for the name.

public bool ContainsName(string name)

Parameters

name string

Returns

bool

GetCode(string)

Get the character code from name

public virtual int GetCode(string name)

Parameters

name string

Character name (eg. euro, ampersand, A, space)

Returns

int

-1 if not found otherwise the character code

GetName(int)

Get the character name corresponding to the given code.

public virtual string GetName(int code)

Parameters

code int

Returns

string

TryGetNamedEncoding(NameToken, out Encoding)

Get a known encoding instance with the given name.

public static bool TryGetNamedEncoding(NameToken name, out Encoding encoding)

Parameters

name NameToken
encoding Encoding

Returns

bool