HaruPage::measureText

(PECL haru >= 0.0.1)

HaruPage::measureTextCalculate the byte length of characters which can be included on one line of the specified width

说明

HaruPage::measureText ( string $text , float $width [, bool $wordwrap = FALSE ] ) : int

Get 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 异常。

参见

相关文章
php mcve 函数 returns array of strings which represents the keys that can be used for response parameters on this transactionphp ncurses 函数 move position and add attributed string with specified lengthphp harufont get the total width of the text number of characters number of words and number of spacesphp harufont calculate the number of characters which can be included within the specified widthphp harupage append a straight line from the current point to the start point of the pathphp harupage get the current line cap stylephp harupage get the current line widthphp harupage draw a line from the current point to the specified pointphp harupage calculate the byte length of characters which can be included on one line of the specified widthphp harupage set line join style for the pagephp harupage set line width for the pagephp phar returns true if the phar archive can be modifiedphp recursiveiterator returns if an iterator can be created for the current entryphp soapserver sets the object which will be used to handle soap requestsphp solrquery returns the maximum number of query terms that will be included in any generated queryphp solrquery returns the maximum word length above which words will be ignoredphp solrquery returns the minimum word length below which words will be ignoredphp solrquery sets the factor by which the regex fragmenter can stray from the ideal fragment sizephp swoole mmap map a file into memory and return the stream resource which can be used by php stream operations.php zookeeper checks if the current zookeeper connection state can be recovered
关注编程学问公众号