HaruPage::measureText
(PECL haru >= 0.0.1)
HaruPage::measureText — Calculate the byte length of characters which can be included on one line of the specified width
说明
$text
, float $width
[, bool $wordwrap
= FALSE
] ) : intGet the byte length of characters which can be included on one line of the specified width.
参数
-
text
-
The text to measure.
-
width
-
The width of the line.
-
wordwrap
-
When this parameter is set to
TRUE
the function "emulates" word wrapping by stopping after the last full word (delimited by whitespace) that can fit on the line.
返回值
Returns the byte length of characters which can be included within the specified width. For single-byte encodings, this is equal to the number of characters. For multi-byte encodings, this is not necessarily the case.
错误/异常
发生错误时抛出 HaruException 异常。
参见
- HaruFont::measureText() - Calculate the number of characters which can be included within the specified width