> For the complete documentation index, see [llms.txt](https://docs.overdare.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.overdare.com/development/api-reference/classes/textservice.md).

# TextService

TextService : `Instance`

## Overview

TextService is a service that calculates the size that text occupies on the screen in advance.

Because the area a sentence occupies changes with the font and the size, it is used to obtain the required size before the UI is placed.

## Properties

## Methods

### GetTextBoundsAsync

A method that calculates the size of the area the text occupies under the specified conditions and returns it in pixels.

The measurement conditions are passed as a GetTextBoundsParams object.

#### Parameters

| `Instance` Params | The GetTextBoundsParams object containing the measurement conditions. |
| ----------------- | --------------------------------------------------------------------- |

#### Return

| `Vector2` | The width and height of the area occupied by the text. |
| --------- | ------------------------------------------------------ |

#### Code Samples

```lua
local TextService = game:GetService("TextService")

local Params = Instance.new("GetTextBoundsParams")
Params.Font = Font.fromName("NotoSans", Enum.FontWeight.Regular, Enum.FontStyle.Normal)
Params.Text = "Hello OVERDARE"
Params.Size = 20
Params.Width = 200

local function GetTextBounds()
    return TextService:GetTextBoundsAsync(Params)
end

local Success, Bounds = pcall(GetTextBounds)

if Success then
    print(Bounds)
end

```

## Events

## See also

{% content-ref url="/pages/kSZpxoIAvTRuGEERWbE0" %}
[GetTextBoundsParams](/development/api-reference/classes/gettextboundsparams.md)
{% endcontent-ref %}
