# MeasureTextSize(string, float, MeasureMode, float, MeasureMode)

> Computes the size needed to display a text string based on element style values such as font, font-size, and word-wrap.

## Definition

* **Type:** Method
* **Namespace:** [UnityEngine.UIElements](/engine/6000.7/script-reference/unityengine/uielements.md)
* **Assembly:** UnityEngine.UIElementsModule

```csharp
public Vector2 MeasureTextSize(string textToMeasure, float width, VisualElement.MeasureMode widthMode, float height, VisualElement.MeasureMode heightMode)
```

### Parameters

**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): The text to measure.**** (\[float]\(https\://learn.microsoft.com/dotnet/api/system.single)): Suggested width. Can be zero.**** (\[MeasureMode]\(/engine/6000.7/script-reference/unityengine/uielements/visualelement/measuremode)): Width restrictions.**** (\[float]\(https\://learn.microsoft.com/dotnet/api/system.single)): Suggested height.**** (\[MeasureMode]\(/engine/6000.7/script-reference/unityengine/uielements/visualelement/measuremode)): Height restrictions.

### Returns

| Type                                                              | Description                                                         |
| ----------------------------------------------------------------- | ------------------------------------------------------------------- |
| [Vector2](/engine/6000.7/script-reference/unityengine/vector2.md) | The horizontal and vertical size needed to display the text string. |
