# Javascript: Selection.shrinkFont Method

> Decreases the font size of each font contained in the current text selection. If no text is selected, this method decreases the font size at the text input position.

- **Product:** TX Text Control .NET Server
- **Section:** Reference
- **Kind:** Method
- **Introduced:** 24.0
- **Path:** TX Text Control .NET Server > Reference > JavaScript API > Javascript: Selection.shrinkFont Method
- **334 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/selection/shrinkfont-method/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/selection/shrinkfont-method/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/selection/shrinkfont-method/llms-full.txt

---

### Description

Decreases the font size of each font contained in the current text selection. If no text is selected, this method decreases the font size at the text input position.

### Syntax

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

### Parameters

| Parameter | Description |
|---|---|
| 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.shrinkFont` in a practical document-editing workflow. Decreases the font size of each font contained in the current text selection. If no text is selected, this method decreases the font size at the text input position.

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

TXTextControl.selection.shrinkFont(
    function() {
        console.log("shrink font completed.");
    },
    onTxError
);
```

---

## Nearby

- **Previous:** [Javascript: Selection.setUnderline Method](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/selection/setunderline-method/llms-full.txt)
- **Next:** [SelectionBounds Object](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/selectionbounds/llms-full.txt)
