(text, fontData)
| 108 | |
| 109 | // Measure the width of the text |
| 110 | var measureTextWidth = function (text, fontData) |
| 111 | { |
| 112 | var width = 0; |
| 113 | |
| 114 | for (var i = 0; i < text.length; i++) |
| 115 | { |
| 116 | var charCode = text.charCodeAt(i); |
| 117 | var glyph = fontData.chars[charCode]; |
| 118 | |
| 119 | if (glyph) |
| 120 | { |
| 121 | width += glyph.xAdvance; |
| 122 | } |
| 123 | } |
| 124 | |
| 125 | return width * sx; |
| 126 | }; |
| 127 | |
| 128 | // Scan for breach of maxWidth and insert carriage-returns |
| 129 | if (maxWidth > 0) |
no outgoing calls
no test coverage detected
searching dependent graphs…