(text, contentWidth, ascCharWidth, cnCharWidth)
| 7937 | } |
| 7938 | |
| 7939 | function estimateLength(text, contentWidth, ascCharWidth, cnCharWidth) { |
| 7940 | var width = 0; |
| 7941 | var i = 0; |
| 7942 | for (var len = text.length; i < len && width < contentWidth; i++) { |
| 7943 | var charCode = text.charCodeAt(i); |
| 7944 | width += (0 <= charCode && charCode <= 127) ? ascCharWidth : cnCharWidth; |
| 7945 | } |
| 7946 | return i; |
| 7947 | } |
| 7948 | |
| 7949 | /** |
| 7950 | * @public |
no outgoing calls
no test coverage detected