TCPDF::GetStringWidth( $s, $fontname = '', $fontstyle = '', $fontsize, $getarray = false )
Returns the length of a string in user unit. A font must be selected.
Description Description
Parameters Parameters
- $s
-
(Required) (string) The string whose length is to be computed
- $fontname
-
(Optional) (string) Family font. It can be either a name defined by AddFont() or one of the standard families. It is also possible to pass an empty string, in that case, the current family is retained.
Default value: ''
- $fontstyle
-
(Optional) (string) Font style. Possible values are (case insensitive):<ul><li>empty string: regular</li><li>B: bold</li><li>I: italic</li><li>U: underline</li><li>D: line-through</li><li>O: overline</li></ul> or any combination. The default value is regular.
Default value: ''
- $fontsize
-
(Required) (float) Font size in points. The default value is the current size.
- $getarray
-
(Optional) (boolean) if true returns an array of characters widths, if false returns the total length.
Default value: false
Return Return
(mixed) int total string length or array of characted widths
Source Source
File: includes/lib/tcpdf/tcpdf.php
Changelog Changelog
Version | Description |
---|---|
1.2 | Introduced. |