DS Server

Javascript: InputFormat.getSupportedFontSizes Method

Method|Introduced in 28.0

Description

Gets an array of strings specifying all possible font sizes for the font at the text input position. If the font is free scalable, standard sizes are returned. The return value is the list of possible font sizes. Null is returned, if the specified font is not supported or if text is selected and the selection contains several different fonts.

Syntax

<void> InputFormat.getSupportedFontSizes(<RequestNumbersCallback> callback, [<string> fontFamily], [<ErrorCallback> errorCallback])

Parameters

ParameterDescription
callback

Receives all possible font sizes as parameter.

fontFamily

Optional. Specifies a font family for the possible sizes of which are returned. It must be a font in the list of supported fonts which are returned through the getFontFamilies method.

errorCallback

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

Examples

The following example demonstrates InputFormat.getSupportedFontSizes in a practical document-editing workflow. It gets an array of strings specifying all possible font sizes for the font at the text input position. If the font is free scalable, standard sizes are returned. The return value is the list of possible font sizes. Null is returned, if the specified font is not supported or if text is selected and the selection contains several different fonts.

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

TXTextControl.inputFormat.getSupportedFontSizes(
    function(result) {
        console.log("get supported font sizes result:", result);
    },
    "Arial",
    onTxError
);