Calculates the width a string would need given a certain font.
Syntax
Width = SRP_String("GetWidth", String, Font)
Parameters
| Parameter | Description |
|---|---|
| String | The string to be measured. (REQUIRED) |
| Font | The font used when measuring the string. (REQUIRED) |
Returns
The width, in pixels, the string would occupy on the screen.
Remarks
The GetWidth service measures strings as they would appear on the screen using a given font. This is useful when you want to calculate the size of a control to fit the given text.
The Font parameter uses the standard FONT structure in OpenInsight and SRP ActiveX Controls. This allows the service to take into account a font's unique attributes, size, weight, etc.
Example
// Sample text
String = 'The quick brown fox jumps over the lazy dog.'
// Font used to measure
Font = 'Calibri' : @SVM : 11 : @SVM : 400
// Measure the width
Width = SRP_String("GetWidth", String, Font)
See Also