• DR-IT Software
  • Products
  • Documentation
  • Product page
  • Examples
  • API reference
  • Support
Show / Hide Table of Contents

Class TtfUnicodeEncoding

Implements IFontEncoding by delegating to a CMap format subtable (TtfCMapFormatBaseTable) selected from a TrueType/OpenType font's "cmap" table.

Inheritance
object
TtfUnicodeEncoding
Implements
IFontEncoding
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: DRIT.Drawing.Font.Encoding
Assembly: DRIT.Drawing.dll
Syntax
public sealed class TtfUnicodeEncoding : IFontEncoding

Constructors

TtfUnicodeEncoding(TtfCMapFormatBaseTable)

Creates a Unicode encoding without legacy symbol-font mapping.

Declaration
public TtfUnicodeEncoding(TtfCMapFormatBaseTable cmapTable)
Parameters
Type Name Description
TtfCMapFormatBaseTable cmapTable

The best Unicode-capable subtable as returned by FindUnicodeTable(). Must not be null.

TtfUnicodeEncoding(TtfCMapFormatBaseTable, bool)

Creates a Unicode encoding with optional legacy symbol-font mapping.

Declaration
public TtfUnicodeEncoding(TtfCMapFormatBaseTable cmapTable, bool legacySymbolFont)
Parameters
Type Name Description
TtfCMapFormatBaseTable cmapTable

The Unicode-capable character map table.

bool legacySymbolFont

Whether to apply the Windows private-use symbol mapping.

Methods

DecodeToGid(char)

Convenience overload that accepts a char (UTF-16 BMP code unit). For code points outside the BMP, use DecodeToGid(uint) directly.

Declaration
public GlyphId? DecodeToGid(char ch)
Parameters
Type Name Description
char ch
Returns
Type Description
GlyphId

DecodeToGid(uint)

Resolves the Unicode codePoint to a glyph identifier. Returns NotDefId when the font has no glyph for the given code point, or null when the encoding map is absent.

Declaration
public GlyphId? DecodeToGid(uint codePoint)
Parameters
Type Name Description
uint codePoint
Returns
Type Description
GlyphId
Remarks

Returns NotDefId (glyph index 0) for code points not present in the font.

HasGlyph(uint)

Returns true when the font provides a real glyph (not .notdef) for codePoint.

Declaration
public bool HasGlyph(uint codePoint)
Parameters
Type Name Description
uint codePoint
Returns
Type Description
bool

TryGetGlyph(uint, out uint)

Returns true when the font provides a real glyph (not .notdef) for codePoint. Used by the fallback resolver to decide whether to substitute a fallback font.

Declaration
public bool TryGetGlyph(uint codePoint, out uint glyphId)
Parameters
Type Name Description
uint codePoint

The Unicode code point to test.

uint glyphId

When this method returns true, the resolved glyph identifier; otherwise 0.

Returns
Type Description
bool

Implements

IFontEncoding
Back to top

DR-IT Software documentation

DR-IT Software · Products · Documentation index · Product page · Downloads · Support · Licensing

Generated by DocFX