[]
Used for serialization of Font subsets.
public class FontWriter
Initializes an instance of the FontWriter.
public FontWriter()
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)
font
FontThe Font object with PostScript outlines stored in the CFF format.
utf32CodeSet
Utf32CodeSetA set of UTF-32 characters to be supported in the resulting table subset.
Binary data with the resulting CFF font table.
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)
font
FontThe 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.
Binary data with the resulting CFF font table.
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)
stream
System.IO.StreamThe destination Stream object.
font
FontThe Font object with PostScript outlines stored in the CFF format.
utf32CodeSet
Utf32CodeSetA set of UTF-32 characters to be supported in the resulting table subset.
The number of bytes saved to the stream.
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)
stream
System.IO.StreamThe destination Stream object.
font
FontThe 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.
The number of bytes saved to the stream.
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)
font
FontThe 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
Utf32CodeSetA set of UTF-32 characters to be supported in the resulting table subset.
Binary data with the resulting CFF font table.
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)
font
FontThe 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.
Binary data with the resulting CFF font table.
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)
stream
System.IO.StreamThe destination Stream object.
font
FontThe 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
Utf32CodeSetA set of UTF-32 characters to be supported in the resulting table subset.
The number of bytes saved to the stream.
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)
stream
System.IO.StreamThe destination Stream object.
font
FontThe 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.
The number of bytes saved to the stream.
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)
font
FontThe 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.
Binary data with the resulting CFF font table.
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)
stream
System.IO.StreamThe destination Stream object.
font
FontThe 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.
The number of bytes saved to the stream.
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)
font
FontThe Font object to serialize.
utf32CodeSet
Utf32CodeSetA set of UTF-32 characters to be supported in the resulting font subset.
subsetFlags
FontSubsetFlagsFont serialization options.
Binary data with the resulting font subset.
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)
font
FontThe Font object to serialize.
utf32Chars
System.Collections.Generic.HashSet<T><int>UTF-32 characters to be supported in the resulting font subset.
subsetFlags
FontSubsetFlagsFont serialization options.
Binary data with the resulting font subset.
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)
stream
System.IO.StreamThe destination Stream object.
font
FontThe Font object to serialize.
utf32CodeSet
Utf32CodeSetA set of UTF-32 characters to be supported in the resulting font subset.
subsetFlags
FontSubsetFlagsFont serialization options.
The number of bytes saved to the stream.
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)
stream
System.IO.StreamThe destination Stream object.
font
FontThe Font object to serialize.
utf32Chars
System.Collections.Generic.HashSet<T><int>UTF-32 characters to be supported in the resulting font subset.
subsetFlags
FontSubsetFlagsFont serialization options.
The number of bytes saved to the stream.
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)
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
FontSubsetFlagsFont serialization flags.
true if some fonts were merged, false otherwise.
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)
font
FontThe Font object to serialize.
glyphIDs
System.Collections.Generic.HashSet<T><ushort>Glyph indices to be added to the resulting font subset.
utf32CodeSet
Utf32CodeSetA set of UTF-32 characters to be supported in the resulting font subset.
subsetFlags
FontSubsetFlagsFont serialization options.
Binary data with the resulting font subset.
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)
font
FontThe 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
FontSubsetFlagsFont serialization options.
Binary data with the resulting font subset.
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)
stream
System.IO.StreamThe destination Stream object.
font
FontThe Font object to serialize.
glyphIDs
System.Collections.Generic.HashSet<T><ushort>Glyph indices to be added to the resulting font subset.
utf32CodeSet
Utf32CodeSetA set of UTF-32 characters to be supported in the resulting font subset.
subsetFlags
FontSubsetFlagsFont serialization options.
The number of bytes saved to the stream.
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)
stream
System.IO.StreamThe destination Stream object.
font
FontThe 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
FontSubsetFlagsFont serialization options.
The number of bytes saved to the stream.
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)
font
FontThe Font object to serialize.
glyphIDs
System.Collections.Generic.HashSet<T><ushort>Glyph indices to be added to the resulting font subset.
subsetFlags
FontSubsetFlagsFont serialization options.
Binary data with the resulting font subset.
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)
stream
System.IO.StreamThe destination Stream object.
font
FontThe Font object to serialize.
glyphIDs
System.Collections.Generic.HashSet<T><ushort>Glyph indices to be added to the resulting font subset.
subsetFlags
FontSubsetFlagsFont serialization options.
The number of bytes saved to the stream.
Writes the CFF table to a byte array.
public byte[] WholeCffToArray(CffTable cff)
cff
CffTableThe CFF table object.
Binary data with the resulting CFF font table.
Writes the whole CFF font table (not subset) to a byte array.
public byte[] WholeCffToArray(Font font)
font
FontThe Font object with PostScript outlines stored in the CFF format.
Binary data with the resulting CFF font table.
Writes the whole CFF font table (not subset) to a stream.
public int WholeCffToStream(Stream stream, Font font)
stream
System.IO.StreamThe destination Stream object.
font
FontThe Font object with PostScript outlines stored in the CFF format.
The number of bytes saved to the stream.
Serializes the whole font (not subset) to a byte array.
public byte[] WholeFontToArray(Font font)
font
FontThe Font object to serialize.
Binary data with the resulting font.
Writes the whole font (not subset) to a stream.
public int WholeFontToStream(Stream stream, Font font)
stream
System.IO.StreamThe destination Stream object.
font
FontThe Font object to serialize.
The number of bytes saved to the stream.