# Javascript: Selection.setCharacterScaling Method

> Sets or sets the style's character scaling, in percent of the average character width.

- **Product:** DS Server
- **Section:** Reference
- **Kind:** Method
- **Introduced:** 30.0
- **Path:** DS Server > Reference > JavaScript API > Javascript: Selection.setCharacterScaling Method
- **348 words**
- **Web URL:** https://docs.textcontrol.com/ds-server/reference/javascript/selection/setcharacterscaling-method/
- **LLMs URL:** https://docs.textcontrol.com/ds-server/reference/javascript/selection/setcharacterscaling-method/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/ds-server/reference/javascript/selection/setcharacterscaling-method/llms-full.txt

---

### Description

Sets or sets the style's character scaling, in percent of the average character width.

### Syntax

```javascript
<void> Selection.setCharacterScaling(<number> characterScaling, [<EmptyRequestCallback> callback], [<ErrorCallback> errorCallback])
```

### Parameters

| Parameter | Description |
|---|---|
| characterScaling | The new value. |
| callback | Optional. Is called when the operation completed. |
| errorCallback | Optional. Is called when the operation failed with an error. |

### Examples

The following example demonstrates `Selection.setCharacterScaling` in a practical document-editing workflow. It sets or sets the style's character scaling, in percent of the average character width.

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

TXTextControl.selection.setCharacterScaling(
    80,
    function() {
        console.log("set character scaling completed.");
    },
    onTxError
);
```

---

## Nearby

- **Previous:** [Javascript: Selection.setCapitals Method](https://docs.textcontrol.com/ds-server/reference/javascript/selection/setcapitals-method/llms-full.txt)
- **Next:** [Javascript: Selection.setCharacterSpacing Method](https://docs.textcontrol.com/ds-server/reference/javascript/selection/setcharacterspacing-method/llms-full.txt)
