Javascript: Selection.getFontName Method
Description
Gets the font name of the selected text.
Syntax
<void> Selection.getFontName(<RequestStringCallback> callback, [<ErrorCallback> errorCallback])Parameters
| Parameter | Description |
|---|---|
| callback | Receives the font name of the selected text. The attribute is an empty string when the text selection contains multiple characters with mixed font names. |
| errorCallback | Optional. Is called when the operation failed with an error. |
Examples
The following example demonstrates Selection.getFontName in a practical document-editing workflow. It gets the font name of the selected text.
function onTxError(error) {
console.error("TX Text Control error:", error.msg);
error.handled = true;
}
TXTextControl.selection.getFontName(
function(result) {
console.log("get font name result:", result);
},
onTxError
);