Table of Contents

Struct CharacterMapping

Namespace
Egami.Fonts
Assembly
Egami.Fonts.dll

A code and the glyph a CharacterMap gives it.

public readonly record struct CharacterMapping : IEquatable<CharacterMapping>
Implements
Inherited Members

Examples

// A symbolic TrueType font in PDF looks a code up in (3,0) first, then (1,0); a non-symbolic one uses (3,1).
CharacterMap? map = trueType.FindCharacterMap(3, 0) ?? trueType.FindCharacterMap(1, 0) ?? trueType.FindCharacterMap(3, 1);
ushort forA = map?.GetGlyph('A') ?? 0;

// A Type1C font without /Encoding uses the CFF program's own encoding.
CharacterMap? own = face.BuiltInEncoding;                  // platform 7, encoding 0: the Standard Encoding
ushort forB = own?.GetGlyph('B') ?? 0;

// Every code the map gives a glyph, in code order, for a PDF writer's /Widths or a ToUnicode table.
int mapped = map?.GetMappings().Count() ?? 0;

Constructors

CharacterMapping(int, ushort)

A code and the glyph a CharacterMap gives it.

public CharacterMapping(int Code, ushort Glyph)

Parameters

Code int

The character code, in the map's own encoding.

Glyph ushort

The glyph id.

Examples

// A symbolic TrueType font in PDF looks a code up in (3,0) first, then (1,0); a non-symbolic one uses (3,1).
CharacterMap? map = trueType.FindCharacterMap(3, 0) ?? trueType.FindCharacterMap(1, 0) ?? trueType.FindCharacterMap(3, 1);
ushort forA = map?.GetGlyph('A') ?? 0;

// A Type1C font without /Encoding uses the CFF program's own encoding.
CharacterMap? own = face.BuiltInEncoding;                  // platform 7, encoding 0: the Standard Encoding
ushort forB = own?.GetGlyph('B') ?? 0;

// Every code the map gives a glyph, in code order, for a PDF writer's /Widths or a ToUnicode table.
int mapped = map?.GetMappings().Count() ?? 0;

Properties

Code

The character code, in the map's own encoding.

public int Code { get; init; }

Property Value

int

Glyph

The glyph id.

public ushort Glyph { get; init; }

Property Value

ushort