Topics
All
MacOS
(Only)
Windows
(Only)
Linux
(Only, Not)
iOS
(Only, Not)
Components
Crossplatform Mac & Win
Server
Client
Old
Deprecated
Guides
Examples
Videos
New in version:
12.1
12.2
12.3
12.4
12.5
13.0
13.1
13.2
13.3
13.4
Statistic
FMM
Blog
Queries how many characters would fit in a space.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
Font | 8.4 | ✅ Yes | ✅ Yes | ❌ No | ✅ Yes, on macOS and Windows | ✅ Yes |
Parameter | Description | Example | Flags |
---|---|---|---|
Text | The text to measure. | "Hello World" | |
MaxWidth | The maximum width. | 100 | |
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 |
Returns number or error.
Checks how much fits:
MBS( "Font.CalculateTextFits"; "Hello World"; 50; "Arial"; 12)
Trying for normal, bold and italic Arial variants:
MBS( "Font.CalculateTextFits"; "Hello World"; 50; "Arial"; 12) & ¶ & MBS( "Font.CalculateTextFits"; "Hello World"; 50; "Arial-ItalicMT"; 12) & ¶ & MBS( "Font.CalculateTextFits"; "Hello World"; 50; "Arial-BoldMT"; 12) & ¶ & MBS( "Font.CalculateTextFits"; "Hello World"; 50; "Arial-BoldItalicMT"; 12)
Example result:
8
8
7
7
This function checks for a license.
Created 12nd September 2018, last changed 1st October 2021