[]
        
(Showing Draft Content)

GrapeCity.Documents.Text.FontCollection

Class FontCollection

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

Represents a collection of Font objects.

public class FontCollection : Collection<Font>, IList, ICollection, IReadOnlyList<Font>, IReadOnlyCollection<Font>, IFontCollection, IList<Font>, ICollection<Font>, IEnumerable<Font>, IEnumerable
Inheritance
object
System.Collections.ObjectModel.Collection<T><Font>
FontCollection
Implements
System.Collections.IList
System.Collections.ICollection
System.Collections.Generic.IReadOnlyList<T><Font>
System.Collections.Generic.IReadOnlyCollection<T><Font>
System.Collections.Generic.IList<T><Font>
System.Collections.Generic.ICollection<T><Font>
System.Collections.Generic.IEnumerable<T><Font>
System.Collections.IEnumerable
Inherited Members
System.Collections.ObjectModel.Collection<GrapeCity.Documents.Text.Font>.Add(GrapeCity.Documents.Text.Font)
System.Collections.ObjectModel.Collection<GrapeCity.Documents.Text.Font>.Clear()
System.Collections.ObjectModel.Collection<GrapeCity.Documents.Text.Font>.CopyTo(GrapeCity.Documents.Text.Font[], int)
System.Collections.ObjectModel.Collection<GrapeCity.Documents.Text.Font>.Contains(GrapeCity.Documents.Text.Font)
System.Collections.ObjectModel.Collection<GrapeCity.Documents.Text.Font>.GetEnumerator()
System.Collections.ObjectModel.Collection<GrapeCity.Documents.Text.Font>.IndexOf(GrapeCity.Documents.Text.Font)
System.Collections.ObjectModel.Collection<GrapeCity.Documents.Text.Font>.Insert(int, GrapeCity.Documents.Text.Font)
System.Collections.ObjectModel.Collection<GrapeCity.Documents.Text.Font>.Remove(GrapeCity.Documents.Text.Font)
System.Collections.ObjectModel.Collection<GrapeCity.Documents.Text.Font>.RemoveAt(int)
System.Collections.ObjectModel.Collection<GrapeCity.Documents.Text.Font>.Count
System.Collections.ObjectModel.Collection<GrapeCity.Documents.Text.Font>.Items
System.Collections.ObjectModel.Collection<GrapeCity.Documents.Text.Font>.this[int]
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()

Constructors

FontCollection()

Initializes a new instance of the FontCollection class.

public FontCollection()

Properties

DefaultFont

Gets or sets the default font.

public Font DefaultFont { get; set; }

Property Value

Font

SyncRoot

Gets an object that can be used to synchronize access to the FontCollection.

public object SyncRoot { get; }

Property Value

object

SystemFonts

Gets the collection of system fonts.

public static SystemFontCollection SystemFonts { get; }

Property Value

SystemFontCollection

Methods

AppendFallbackFontFamilies(params string[])

Appends one or more font family names to the internal list of fallback font families.

public void AppendFallbackFontFamilies(params string[] fontFamilyNames)

Parameters

fontFamilyNames string[]

AppendFallbackFonts(params Font[])

Appends one or more fonts to the internal fallback font list.

public void AppendFallbackFonts(params Font[] fonts)

Parameters

fonts Font[]

AppendFonts(IList<Font>, bool)

Appends fonts from the specified list to the collection.

public void AppendFonts(IList<Font> list, bool addToFallbacks)

Parameters

list System.Collections.Generic.IList<T><Font>

The list with fonts.

addToFallbacks bool

Specifies if the fonts should be added to the fallback font collection as well.

ChooseFallbackFont(int, Font, bool, bool, bool, bool, bool)

Searches for a fallback font containing the given code point that looks similar to the source font.

public Font ChooseFallbackFont(int codePoint, Font baseFont, bool bold, bool italic, bool vertical = false, bool embeddable = false, bool allowEudc = false)

Parameters

codePoint int

The code point (in UTF-32 format) missing in the source font.

baseFont Font

The source font to be replaced by a fallback font.

bold bool

Indicates if the font should be bold.

italic bool

Indicates if the font should contain italic characters.

vertical bool

Indicates if the font should be vertical.

embeddable bool

Indicates if the searched font should support embedding.

allowEudc bool

Indicates if the linked EUDC fonts can be searched as well.

Returns

Font

Fallback Font or null.

ClearFallbackFontFamilies()

Clears the internal list of fallback font families.

public void ClearFallbackFontFamilies()

ClearFallbackFonts()

Clears the internal list of fallback fonts.

public void ClearFallbackFonts()

ClearItems()

Removes all elements from the FontCollection.

protected override void ClearItems()

Clone()

Creates a copy of the current FontCollection.

public FontCollection Clone()

Returns

FontCollection

FindFamilyName(string, bool, bool)

Searches for a font with the specified family name and style.

public Font FindFamilyName(string fontFamilyName, bool bold = false, bool italic = false)

Parameters

fontFamilyName string

The font family name. Up to four fonts can share the same font family name.

bold bool

Indicates whether the font should be bold.

italic bool

Indicates whether the font should contain Italic characters.

Returns

Font

The corresponding Font or null.

FindFamilyName(string[], bool, bool)

Searches for a font from the set of allowable font family names and the specified style.

public Font FindFamilyName(string[] fontFamilyNames, bool bold = false, bool italic = false)

Parameters

fontFamilyNames string[]

The array of allowable font family name.

bold bool

Indicates if the font should be bold.

italic bool

Indicates if the font should contain Italic characters.

Returns

Font

The corresponding Font or null.

FindFileName(string)

Searches for the first font having the specified file name.

public Font FindFileName(string fontFileName)

Parameters

fontFileName string

Returns

Font

FindFontPath(string)

Searches for the first font having the specified font path.

public Font FindFontPath(string fontPath)

Parameters

fontPath string

Returns

Font

FindFullName(string)

Searches for the first font with specified full name.

Full font name that reflects all family and relevant subfamily descriptors.

public Font FindFullName(string fullFontName)

Parameters

fullFontName string

Returns

Font

GetFallbackFontFamilies()

Gets a snapshot of the internal list of fallback font families.

public string[] GetFallbackFontFamilies()

Returns

string[]

GetFallbackFonts()

Gets a snapshot of the internal fallback font list.

public Font[] GetFallbackFonts()

Returns

Font[]

InsertItem(int, Font)

Inserts an element into the FontCollection at the specified index.

protected override void InsertItem(int index, Font item)

Parameters

index int
item Font

LoadFonts(byte[], bool)

Loads all fonts from a specified byte array into the collection.

Use the RegisterFont(string, bool) method if there is a font file.

public int LoadFonts(byte[] fontData, bool addToFallbacks = false)

Parameters

fontData byte[]

The byte array with the font data.

addToFallbacks bool

Specifies if all the registered fonts should be added to the fallback font collection.

Returns

int

The number of loaded fonts.

LoadFonts(Stream, int, bool)

Loads all fonts from the specified stream into the collection.

Use the RegisterFont(string, bool) method if there is a font file.

public int LoadFonts(Stream stream, int bytesToRead = -1, bool addToFallbacks = false)

Parameters

stream System.IO.Stream

The stream containing the font data.

bytesToRead int

The number of bytes to read from the stream; -1 causes reading till the end of stream.

addToFallbacks bool

Specifies if all the registered fonts should be added to the fallback font collection.

Returns

int

The number of loaded fonts.

RegisterDirectory(string, bool)

Appends all fonts (*.ttf, *.otf, *.ttc files) from the specified folder to the FontCollection.

public int RegisterDirectory(string folderPath, bool addToFallbacks = false)

Parameters

folderPath string

Path to the source directory with fonts.

addToFallbacks bool

Specifies if all the registered fonts should be added to the fallback font collection.

Returns

int

The number of registered fonts.

RegisterFont(string, bool)

Appends all fonts from the specified font file to the collection.

public int RegisterFont(string fontPath, bool addToFallbacks = false)

Parameters

fontPath string

Path to the source font file.

addToFallbacks bool

Specifies if all the registered fonts should be added to the fallback font collection.

Returns

int

The number of registered fonts.

RemoveFallbackFontFamilies(params string[])

Removes one or more font family names from the internal list of fallback font families.

public void RemoveFallbackFontFamilies(params string[] fontFamilyNames)

Parameters

fontFamilyNames string[]

RemoveFallbackFonts(params Font[])

Removes one or more fonts from the internal fallback font list.

public void RemoveFallbackFonts(params Font[] fonts)

Parameters

fonts Font[]

RemoveItem(int)

Removes the element at the specified index of the FontCollection.

protected override void RemoveItem(int index)

Parameters

index int

SelectByFamilyName(string, List<Font>)

Collects the fonts with the specified family name.

public void SelectByFamilyName(string fontFamilyName, List<Font> res)

Parameters

fontFamilyName string
res System.Collections.Generic.List<T><Font>

SelectByFamilyName(string)

Returns the list of fonts with the specified family name.

public List<Font> SelectByFamilyName(string fontFamilyName)

Parameters

fontFamilyName string

Returns

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

SelectByFileName(string, List<Font>)

Collects the fonts having the same specified file name.

public void SelectByFileName(string fontFileName, List<Font> res)

Parameters

fontFileName string
res System.Collections.Generic.List<T><Font>

SelectByFileName(string)

Returns the list of fonts having the same specified file name.

public List<Font> SelectByFileName(string fontFileName)

Parameters

fontFileName string

Returns

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

SelectByFontPath(string, List<Font>)

Collects the fonts having the same specified font path.

public void SelectByFontPath(string fontPath, List<Font> res)

Parameters

fontPath string
res System.Collections.Generic.List<T><Font>

SelectByFontPath(string)

Returns the list of fonts having the same specified font path.

public List<Font> SelectByFontPath(string fontPath)

Parameters

fontPath string

Returns

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

SelectByFullName(string, List<Font>)

Collects the fonts with the specified full name.

Full font name that reflects all family and relevant subfamily descriptors.

public void SelectByFullName(string fullFontName, List<Font> res)

Parameters

fullFontName string
res System.Collections.Generic.List<T><Font>

SelectByFullName(string)

Returns the list of fonts with the specified full name.

Full font name that reflects all family and relevant subfamily descriptors.

public List<Font> SelectByFullName(string fullFontName)

Parameters

fullFontName string

Returns

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

SelectByTypographicFamilyName(string, List<Font>)

Collects the fonts with the specified typographic family name.

The typographic family grouping doesn't impose any constraints on the number of faces within it, in contrast with the 4-style family grouping.

public void SelectByTypographicFamilyName(string typographicFamilyName, List<Font> res)

Parameters

typographicFamilyName string
res System.Collections.Generic.List<T><Font>

SelectByTypographicFamilyName(string)

Returns the list of fonts with the specified typographic family name.

The typographic family grouping doesn't impose any constraints on the number of faces within it, in contrast with the 4-style family grouping.

public List<Font> SelectByTypographicFamilyName(string typographicFamilyName)

Parameters

typographicFamilyName string

Returns

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

SetItem(int, Font)

Replaces the element at the specified index.

protected override void SetItem(int index, Font item)

Parameters

index int
item Font