Topics   All   Mac OS X (Only)   Windows (Only)   Linux (Only, Not)   iOS (Only, Not)  
Components   Crossplatform Mac & Win   Server (Not)   Client   Old   Guides   Examples
New in version: 6.1   6.2   6.3   6.4   6.5   7.0   7.1   7.2   7.3   7.4    Statistic  

Font.CalculateTextWidth

Calculates with of text.

Component Version macOS Windows Server FileMaker Cloud FileMaker iOS SDK
Font 6.5 Yes Yes Yes No Yes

MBS( "Font.CalculateTextWidth"; Text { ; Font; Size } )

Parameters

Parameter Description Example value
Text The text to measure. "Hello World"
Font Optional
The font name.
Using System font in case of empty parameter.
"Arial"
Size Optional
The font size to use.
Default is system font size.
12

Result

Returns number or error.

Description

Calculates with of text.
The plugin uses system font rendering to calculate with. This may be different from what FileMaker renders with it's own engine.
You can use the measured size to detect if text fits a field.

Examples

Calculate width of Hello World:

MBS( "Font.CalculateTextWidth"; "Hello World" )
# e.g. 70.9 on Mac and 77 on Windows.

Calculate with Arial

MBS( "Font.CalculateTextWidth"; "Hello World"; "Arial"; 12 )
# e.g. 61 on Windows, 61,7 on Mac

Example Databases


Font.Activate   -   Font.Deactivate

Feedback: Report problem or ask question.




Links
MBS Xojo Plugins