DS Server

Javascript: Selection.getFontSize Method

Method|Introduced in 26.0

Description

Gets the font's size, in points, of the selected text.

Syntax

<void> Selection.getFontSize(<RequestNumberCallback> callback, [<ErrorCallback> errorCallback])

Parameters

ParameterDescription
callback

Receives the the fontsize attribute of the selected text. The property's default value is 10 points, which equals 200 twips. The property returns its default value when the text selection contains multiple characters with mixed font sizes.

errorCallback

Optional. Is called when the operation failed with an error.

Examples

The following example demonstrates Selection.getFontSize in a practical document-editing workflow. It gets the font's size, in points, of the selected text.

function onTxError(error) {
    console.error("TX Text Control error:", error.msg);
    error.handled = true;
}

TXTextControl.selection.getFontSize(
    function(result) {
        console.log("get font size result:", result);
    },
    onTxError
);