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 deque returns a representation that can be converted to jsonphp cubrid mysql 兼容性函数 get the maximum length of the specified fieldphp frontbase 函数 returns the length of the specified fieldphp mcve 函数 returns array of strings which represents the keys that can be used for response parameters on this transactionphp snmp 函数 return all objects including their respective object id within the specified onephp harufont calculate the number of characters which can be included within the specified widthphp 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 move text position to the start of the next linephp harupage set line width for the pagephp mongodb bson javascript returns a representation that can be converted to jsonphp mongodb bson objectid returns a representation that can be converted to jsonphp recursiveregexiterator returns whether an iterator can be obtained for the current entryphp solrquery returns the minimum counts for facet fields should be included in the responsephp solrquery returns the maximum word length above which words will be ignoredphp solrquery returns the treshold frequency at which words will be ignored which do not occur in at least this many docsphp solrquery returns the frequency below which terms will be ignored in the source documentphp solrquery returns the minimum word length below which words will be ignoredphp swoole mmap map a file into memory and return the stream resource which can be used by php stream operations.
关注编程学问公众号