Class Hyphenation
Provides process-level registration and lookup of custom hyphenation dictionaries.
Inherited Members
Namespace: DRIT.Document
Assembly: DRIT.Document.dll
Syntax
public static class Hyphenation
Properties
Callback
Gets or sets the callback used to load a missing language dictionary on demand.
Declaration
public static IHyphenationCallback Callback { get; set; }
Property Value
| Type | Description |
|---|---|
| IHyphenationCallback |
Methods
ClearDictionaries()
Removes all registered dictionaries.
Declaration
public static void ClearDictionaries()
Remarks
This method is intended for application reset and test isolation. It does not clear the Callback property.
Hyphenate(string, string)
Gets the hyphenation points for a word, requesting a missing dictionary through Callback.
Declaration
public static IList<int> Hyphenate(string language, string word)
Parameters
| Type | Name | Description |
|---|---|---|
| string | language | The language tag for the word. |
| string | word | The word to hyphenate. |
Returns
| Type | Description |
|---|---|
| IList<int> | The dictionary-provided split positions, or an empty list when no dictionary is available. |
IsDictionaryRegistered(string)
Determines whether a dictionary is registered for a language tag.
Declaration
public static bool IsDictionaryRegistered(string language)
Parameters
| Type | Name | Description |
|---|---|---|
| string | language | The language tag to check. |
Returns
| Type | Description |
|---|---|
| bool | true when a dictionary is registered. |
RegisterDictionary(string, HyphenationDictionary)
Registers or replaces a dictionary for a language tag.
Declaration
public static void RegisterDictionary(string language, HyphenationDictionary dictionary)
Parameters
| Type | Name | Description |
|---|---|---|
| string | language | An ISO language tag such as |
| HyphenationDictionary | dictionary | The dictionary to register. |
RegisterDictionary(string, Stream, Encoding)
Loads and registers a TeX pattern dictionary from a stream.
Declaration
public static void RegisterDictionary(string language, Stream stream, Encoding encoding = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | language | The language tag associated with the dictionary. |
| Stream | stream | The stream containing TeX pattern text. |
| Encoding | encoding | The text encoding; UTF-8 is used when omitted. |
RegisterDictionary(string, string, Encoding)
Loads and registers a TeX pattern dictionary from a file.
Declaration
public static void RegisterDictionary(string language, string path, Encoding encoding = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | language | The language tag associated with the dictionary. |
| string | path | The path to the TeX pattern file. |
| Encoding | encoding | The text encoding; UTF-8 is used when omitted. |
TryGetDictionary(string, out HyphenationDictionary)
Gets a registered dictionary without invoking the callback.
Declaration
public static bool TryGetDictionary(string language, out HyphenationDictionary dictionary)
Parameters
| Type | Name | Description |
|---|---|---|
| string | language | The language tag to look up. |
| HyphenationDictionary | dictionary | The registered dictionary, when found. |
Returns
| Type | Description |
|---|---|
| bool | true when a dictionary was found. |
UnregisterDictionary(string)
Removes the dictionary registered for a language tag.
Declaration
public static bool UnregisterDictionary(string language)
Parameters
| Type | Name | Description |
|---|---|---|
| string | language | The language tag to remove. |
Returns
| Type | Description |
|---|---|
| bool | true when a dictionary was removed. |