Font.CalculateTextHeight
------------------------

Calculates height of text.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [Font](component_Font.md) | [8.4](newinversion84.md) | ✅ Yes | ✅ Yes | ❌ No | ✅ Yes, on macOS and Windows | ✅ Yes |

MBS( "Font.CalculateTextHeight"; Text { ; Warp Width; Font; Size } ) 

**MBS**( **"Font.CalculateTextHeight"** /\* Calculates height of text. \*/  
**$Text**; /\* The text to measure. e.g. "Hello World" \*/   
**$Warp Width**; /\* Optional; The width of the text block to use for wrapping.  
If &lt; 50 will be set to 50 to avoid endless loops. e.g. 500 \*/   
**$Font**; /\* Optional; The font name.  
Using System font in case of empty parameter. e.g. "Arial" \*/   
**$Size**) /\* Optional; The font size to use.  
Default is system font size. e.g. 12 \*/ 

### Parameters

| Parameter | Description | Example | Flags |
|---|---|---|---|
| Text | The text to measure. | "Hello World" |  |
| Warp Width | The width of the text block to use for wrapping.   If &lt; 50 will be set to 50 to avoid endless loops. | 500 | Optional |
| Font | The font name.   Using System font in case of empty parameter. | "Arial" | Optional |
| Size | The font size to use.   Default is system font size. | 12 | Optional |

### Result

Returns number or error.

### Description

Calculates height of text.  
The plugin uses system font rendering to calculate height given your wrap width. This may be different from what FileMaker renders with its own engine.  
You can use the measured size to detect if text fits a field.  
  
Mac result in logical points, but on Windows in pixels.  
### Examples

Calculates text height for a given text:

 MBS ( "Font.CalculateTextHeight"; "Hello World. Just a test."; 100; "Arial"; 12 )  
<small>  
Example result: 36</small>### See also

- [Font.CalculateTextFits](FontCalculateTextFits.md)
- [Font.CalculateTextWidth](FontCalculateTextWidth.md)

### Release notes

- **Version 8.4**
    - Added [Font.CalculateTextFits](http://www.mbsplugins.eu/FontCalculateTextFits.shtml) and [Font.CalculateTextHeight](http://www.mbsplugins.eu/FontCalculateTextHeight.shtml) function.

### Example Databases

- [Utility functions/Calculate Text Size](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Utility%20functions/Calculate%20Text%20Size.shtml#12910FieldAnchor_)

### Blog Entries

- [Calculate Text Sizes](https://www.mbsplugins.de/archive/2021-10-03/Calculate_Text_Sizes/monkeybreadsoftware_blog_filemaker)
- [Neues MBS FileMaker Plugin 8.4 - Über 5400 Funktionen in einem Plugin](https://www.mbsplugins.de/archive/2018-09-25/Neues_MBS_FileMaker_Plugin_84_/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin 8.4 - More than 5400 Functions In One Plugin](https://www.mbsplugins.de/archive/2018-09-25/MBS_FileMaker_Plugin_84_-_More/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 8.4pr7](https://www.mbsplugins.de/archive/2018-09-03/MBS_FileMaker_Plugin_version_8/monkeybreadsoftware_blog_filemaker)

This function checks for a license.

Created 3th September 2018 , last changed 14th July 2022

  
[Font.CalculateTextFits](FontCalculateTextFits.md) - [Font.CalculateTextWidth](FontCalculateTextWidth.md)

[HTML Version](FontCalculateTextHeight.shtml)