DS Server

Javascript: FormattingStyle.getAutoBaseline Method

Method|Introduced in 30.0

Description

Gets values specifying automatic sub- or superscripted text. When using automatic sub- and superscript the font is scaled and moved above or below the baseline with values defined through the font itself. Automatic sub- and superscript can be combined with a user-defined baseline which can be set with the Baseline property.

Syntax

<void> FormattingStyle.getAutoBaseline([<RequestAutoBaselineCallback> callback], [<ErrorCallback> errorCallback])

Parameters

ParameterDescription
callback

Optional. Is called when the operation completed.

errorCallback

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

Examples

The following example demonstrates FormattingStyle.getAutoBaseline in a practical document-editing workflow. It gets values specifying automatic sub- or superscripted text. When using automatic sub- and superscript the font is scaled and moved above or below the baseline with values defined through the font itself. Automatic sub- and superscript can be combined with a user-defined baseline which can be set with the Baseline property.

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

function inspectAutoBaseline(formattingStyle) {
    formattingStyle.getAutoBaseline(
        function(result) {
            if (!result) {
                console.warn("No auto baseline was returned.");
                return;
            }
            
            console.log("get auto baseline result:", result);
        },
        onTxError
    );
}