[]
        
(Showing Draft Content)

GrapeCity.Documents.Text.FontWriter

Class FontWriter

Namespace
GrapeCity.Documents.Text
Assembly
GcDocs.Imaging.dll

Used for serialization of Font subsets.

public class FontWriter
Inheritance
object
FontWriter
Inherited Members
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()

Constructors

FontWriter()

Initializes an instance of the FontWriter.

public FontWriter()

Methods

CffCharsToArray(Font, Utf32CodeSet)

Creates a subset of the CFF font table containing the specified UTF-32 characters, then serializes the subset to a byte array.

public byte[] CffCharsToArray(Font font, Utf32CodeSet utf32CodeSet)

Parameters

font Font

The Font object with PostScript outlines stored in the CFF format.

utf32CodeSet Utf32CodeSet

A set of UTF-32 characters to be supported in the resulting table subset.

Returns

byte[]

Binary data with the resulting CFF font table.

CffCharsToArray(Font, HashSet<int>)

Creates a subset of the CFF font table containing the specified UTF-32 characters, then serializes the subset to a byte array.

public byte[] CffCharsToArray(Font font, HashSet<int> utf32Chars)

Parameters

font Font

The Font object with PostScript outlines stored in the CFF format.

utf32Chars System.Collections.Generic.HashSet<T><int>

UTF-32 characters to be supported in the resulting table subset.

Returns

byte[]

Binary data with the resulting CFF font table.

CffCharsToStream(Stream, Font, Utf32CodeSet)

Writes a subset of the CFF font table containing the specified UTF-32 characters to a stream.

public int CffCharsToStream(Stream stream, Font font, Utf32CodeSet utf32CodeSet)

Parameters

stream System.IO.Stream

The destination Stream object.

font Font

The Font object with PostScript outlines stored in the CFF format.

utf32CodeSet Utf32CodeSet

A set of UTF-32 characters to be supported in the resulting table subset.

Returns

int

The number of bytes saved to the stream.

CffCharsToStream(Stream, Font, HashSet<int>)

Writes a subset of the CFF font table containing the specified UTF-32 characters to a stream.

public int CffCharsToStream(Stream stream, Font font, HashSet<int> utf32Chars)

Parameters

stream System.IO.Stream

The destination Stream object.

font Font

The Font object with PostScript outlines stored in the CFF format.

utf32Chars System.Collections.Generic.HashSet<T><int>

UTF-32 characters to be supported in the resulting table subset.

Returns

int

The number of bytes saved to the stream.

CffGlyphsAndCharsToArray(Font, HashSet<ushort>, Utf32CodeSet)

Creates a subset of the CFF font table containing both the specified glyphs and UTF-32 characters, then serializes the subset to a byte array.

public byte[] CffGlyphsAndCharsToArray(Font font, HashSet<ushort> glyphIDs, Utf32CodeSet utf32CodeSet)

Parameters

font Font

The Font object with PostScript outlines stored in the CFF format.

glyphIDs System.Collections.Generic.HashSet<T><ushort>

Glyph indices to be added to the resulting table subset.

utf32CodeSet Utf32CodeSet

A set of UTF-32 characters to be supported in the resulting table subset.

Returns

byte[]

Binary data with the resulting CFF font table.

CffGlyphsAndCharsToArray(Font, HashSet<ushort>, HashSet<int>)

Creates a subset of the CFF font table containing both the specified glyphs and UTF-32 characters, then serializes the subset to a byte array.

public byte[] CffGlyphsAndCharsToArray(Font font, HashSet<ushort> glyphIDs, HashSet<int> utf32Chars)

Parameters

font Font

The Font object with PostScript outlines stored in the CFF format.

glyphIDs System.Collections.Generic.HashSet<T><ushort>

Glyph indices to be added to the resulting table subset.

utf32Chars System.Collections.Generic.HashSet<T><int>

UTF-32 characters to be supported in the resulting table subset.

Returns

byte[]

Binary data with the resulting CFF font table.

CffGlyphsAndCharsToStream(Stream, Font, HashSet<ushort>, Utf32CodeSet)

Writes a subset of the CFF font table containing both the specified glyphs and UTF-32 characters to a stream.

public int CffGlyphsAndCharsToStream(Stream stream, Font font, HashSet<ushort> glyphIDs, Utf32CodeSet utf32CodeSet)

Parameters

stream System.IO.Stream

The destination Stream object.

font Font

The Font object with PostScript outlines stored in the CFF format.

glyphIDs System.Collections.Generic.HashSet<T><ushort>

Glyph indices to be added to the resulting table subset.

utf32CodeSet Utf32CodeSet

A set of UTF-32 characters to be supported in the resulting table subset.

Returns

int

The number of bytes saved to the stream.

CffGlyphsAndCharsToStream(Stream, Font, HashSet<ushort>, HashSet<int>)

Writes a subset of the CFF font table containing both the specified glyphs and UTF-32 characters to a stream.

public int CffGlyphsAndCharsToStream(Stream stream, Font font, HashSet<ushort> glyphIDs, HashSet<int> utf32Chars)

Parameters

stream System.IO.Stream

The destination Stream object.

font Font

The Font object with PostScript outlines stored in the CFF format.

glyphIDs System.Collections.Generic.HashSet<T><ushort>

Glyph indices to be added to the resulting table subset.

utf32Chars System.Collections.Generic.HashSet<T><int>

UTF-32 characters to be supported in the resulting table subset.

Returns

int

The number of bytes saved to the stream.

CffGlyphsToArray(Font, HashSet<ushort>)

Creates a subset of the CFF font table containing the specified glyphs, then serializes the subset to a byte array.

public byte[] CffGlyphsToArray(Font font, HashSet<ushort> glyphIDs)

Parameters

font Font

The Font object with PostScript outlines stored in the CFF format.

glyphIDs System.Collections.Generic.HashSet<T><ushort>

Glyph indices to be added to the resulting table subset.

Returns

byte[]

Binary data with the resulting CFF font table.

CffGlyphsToStream(Stream, Font, HashSet<ushort>)

Writes a subset of the CFF font table containing the specified glyphs to a stream.

public int CffGlyphsToStream(Stream stream, Font font, HashSet<ushort> glyphIDs)

Parameters

stream System.IO.Stream

The destination Stream object.

font Font

The Font object with PostScript outlines stored in the CFF format.

glyphIDs System.Collections.Generic.HashSet<T><ushort>

Glyph indices to be added to the resulting table subset.

Returns

int

The number of bytes saved to the stream.

CharsToArray(Font, Utf32CodeSet, FontSubsetFlags)

Creates a subset of the font containing the specified UTF-32 characters, then serializes the subset to a byte array.

public byte[] CharsToArray(Font font, Utf32CodeSet utf32CodeSet, FontSubsetFlags subsetFlags = FontSubsetFlags.PdfTextField)

Parameters

font Font

The Font object to serialize.

utf32CodeSet Utf32CodeSet

A set of UTF-32 characters to be supported in the resulting font subset.

subsetFlags FontSubsetFlags

Font serialization options.

Returns

byte[]

Binary data with the resulting font subset.

CharsToArray(Font, HashSet<int>, FontSubsetFlags)

Creates a subset of the font containing the specified UTF-32 characters, then serializes the subset to a byte array.

public byte[] CharsToArray(Font font, HashSet<int> utf32Chars, FontSubsetFlags subsetFlags = FontSubsetFlags.PdfTextField)

Parameters

font Font

The Font object to serialize.

utf32Chars System.Collections.Generic.HashSet<T><int>

UTF-32 characters to be supported in the resulting font subset.

subsetFlags FontSubsetFlags

Font serialization options.

Returns

byte[]

Binary data with the resulting font subset.

CharsToStream(Stream, Font, Utf32CodeSet, FontSubsetFlags)

Writes a subset of the font containing the specified UTF-32 characters to a stream.

public int CharsToStream(Stream stream, Font font, Utf32CodeSet utf32CodeSet, FontSubsetFlags subsetFlags = FontSubsetFlags.PdfTextField)

Parameters

stream System.IO.Stream

The destination Stream object.

font Font

The Font object to serialize.

utf32CodeSet Utf32CodeSet

A set of UTF-32 characters to be supported in the resulting font subset.

subsetFlags FontSubsetFlags

Font serialization options.

Returns

int

The number of bytes saved to the stream.

CharsToStream(Stream, Font, HashSet<int>, FontSubsetFlags)

Writes a subset of the font containing the specified UTF-32 characters to a stream.

public int CharsToStream(Stream stream, Font font, HashSet<int> utf32Chars, FontSubsetFlags subsetFlags = FontSubsetFlags.PdfTextField)

Parameters

stream System.IO.Stream

The destination Stream object.

font Font

The Font object to serialize.

utf32Chars System.Collections.Generic.HashSet<T><int>

UTF-32 characters to be supported in the resulting font subset.

subsetFlags FontSubsetFlags

Font serialization options.

Returns

int

The number of bytes saved to the stream.

CompactFonts(List<Font>, out int[], out byte[][], FontSubsetFlags)

Merges matching TrueType font subsets and serializes the merged subsets to byte arrays.

public bool CompactFonts(List<Font> fonts, out int[] indices, out byte[][] mergedFonts, FontSubsetFlags subsetFlags)

Parameters

fonts System.Collections.Generic.List<T><Font>

The list of source font subsets.

indices int[]

OUT: an array of indices mapping source font indices to merged font indices. 0 indicates non-merged fonts.

mergedFonts byte[][]

OUT: an array containing binary data of merged fonts. mergedFonts[0] is always null.

subsetFlags FontSubsetFlags

Font serialization flags.

Returns

bool

true if some fonts were merged, false otherwise.

GlyphsAndCharsToArray(Font, HashSet<ushort>, Utf32CodeSet, FontSubsetFlags)

Creates a subset of the font containing both the specified glyphs and UTF-32 characters, then serializes the subset to a byte array.

public byte[] GlyphsAndCharsToArray(Font font, HashSet<ushort> glyphIDs, Utf32CodeSet utf32CodeSet, FontSubsetFlags subsetFlags = FontSubsetFlags.PdfTextField)

Parameters

font Font

The Font object to serialize.

glyphIDs System.Collections.Generic.HashSet<T><ushort>

Glyph indices to be added to the resulting font subset.

utf32CodeSet Utf32CodeSet

A set of UTF-32 characters to be supported in the resulting font subset.

subsetFlags FontSubsetFlags

Font serialization options.

Returns

byte[]

Binary data with the resulting font subset.

GlyphsAndCharsToArray(Font, HashSet<ushort>, HashSet<int>, FontSubsetFlags)

Creates a subset of the font containing both the specified glyphs and UTF-32 characters, then serializes the subset to a byte array.

public byte[] GlyphsAndCharsToArray(Font font, HashSet<ushort> glyphIDs, HashSet<int> utf32Chars, FontSubsetFlags subsetFlags = FontSubsetFlags.PdfTextField)

Parameters

font Font

The Font object to serialize.

glyphIDs System.Collections.Generic.HashSet<T><ushort>

Glyph indices to be added to the resulting font subset.

utf32Chars System.Collections.Generic.HashSet<T><int>

UTF-32 characters to be supported in the resulting font subset.

subsetFlags FontSubsetFlags

Font serialization options.

Returns

byte[]

Binary data with the resulting font subset.

GlyphsAndCharsToStream(Stream, Font, HashSet<ushort>, Utf32CodeSet, FontSubsetFlags)

Writes a subset of the font containing both the specified glyphs and UTF-32 characters to a stream.

public int GlyphsAndCharsToStream(Stream stream, Font font, HashSet<ushort> glyphIDs, Utf32CodeSet utf32CodeSet, FontSubsetFlags subsetFlags = FontSubsetFlags.PdfTextField)

Parameters

stream System.IO.Stream

The destination Stream object.

font Font

The Font object to serialize.

glyphIDs System.Collections.Generic.HashSet<T><ushort>

Glyph indices to be added to the resulting font subset.

utf32CodeSet Utf32CodeSet

A set of UTF-32 characters to be supported in the resulting font subset.

subsetFlags FontSubsetFlags

Font serialization options.

Returns

int

The number of bytes saved to the stream.

GlyphsAndCharsToStream(Stream, Font, HashSet<ushort>, HashSet<int>, FontSubsetFlags)

Writes a subset of the font containing both the specified glyphs and UTF-32 characters to a stream.

public int GlyphsAndCharsToStream(Stream stream, Font font, HashSet<ushort> glyphIDs, HashSet<int> utf32Chars, FontSubsetFlags subsetFlags = FontSubsetFlags.PdfTextField)

Parameters

stream System.IO.Stream

The destination Stream object.

font Font

The Font object to serialize.

glyphIDs System.Collections.Generic.HashSet<T><ushort>

Glyph indices to be added to the resulting font subset.

utf32Chars System.Collections.Generic.HashSet<T><int>

UTF-32 characters to be supported in the resulting font subset.

subsetFlags FontSubsetFlags

Font serialization options.

Returns

int

The number of bytes saved to the stream.

GlyphsToArray(Font, HashSet<ushort>, FontSubsetFlags)

Creates a subset of the font containing the specified glyphs, then serializes the subset to a byte array.

public byte[] GlyphsToArray(Font font, HashSet<ushort> glyphIDs, FontSubsetFlags subsetFlags = FontSubsetFlags.PdfRenderer)

Parameters

font Font

The Font object to serialize.

glyphIDs System.Collections.Generic.HashSet<T><ushort>

Glyph indices to be added to the resulting font subset.

subsetFlags FontSubsetFlags

Font serialization options.

Returns

byte[]

Binary data with the resulting font subset.

GlyphsToStream(Stream, Font, HashSet<ushort>, FontSubsetFlags)

Writes a subset of the font containing the specified glyphs to a stream.

public int GlyphsToStream(Stream stream, Font font, HashSet<ushort> glyphIDs, FontSubsetFlags subsetFlags = FontSubsetFlags.PdfRenderer)

Parameters

stream System.IO.Stream

The destination Stream object.

font Font

The Font object to serialize.

glyphIDs System.Collections.Generic.HashSet<T><ushort>

Glyph indices to be added to the resulting font subset.

subsetFlags FontSubsetFlags

Font serialization options.

Returns

int

The number of bytes saved to the stream.

WholeCffToArray(CffTable)

Writes the CFF table to a byte array.

public byte[] WholeCffToArray(CffTable cff)

Parameters

cff CffTable

The CFF table object.

Returns

byte[]

Binary data with the resulting CFF font table.

WholeCffToArray(Font)

Writes the whole CFF font table (not subset) to a byte array.

public byte[] WholeCffToArray(Font font)

Parameters

font Font

The Font object with PostScript outlines stored in the CFF format.

Returns

byte[]

Binary data with the resulting CFF font table.

WholeCffToStream(Stream, Font)

Writes the whole CFF font table (not subset) to a stream.

public int WholeCffToStream(Stream stream, Font font)

Parameters

stream System.IO.Stream

The destination Stream object.

font Font

The Font object with PostScript outlines stored in the CFF format.

Returns

int

The number of bytes saved to the stream.

WholeFontToArray(Font)

Serializes the whole font (not subset) to a byte array.

public byte[] WholeFontToArray(Font font)

Parameters

font Font

The Font object to serialize.

Returns

byte[]

Binary data with the resulting font.

WholeFontToStream(Stream, Font)

Writes the whole font (not subset) to a stream.

public int WholeFontToStream(Stream stream, Font font)

Parameters

stream System.IO.Stream

The destination Stream object.

font Font

The Font object to serialize.

Returns

int

The number of bytes saved to the stream.