(str, x, y, options)
| 2444 | } |
| 2445 | |
| 2446 | function text(str, x, y, options) { |
| 2447 | /* Draws the string at the given position. |
| 2448 | * Lines of text will be split at \n. |
| 2449 | * The text will be displayed with the current state font(), fontsize(), fontweight(). |
| 2450 | */ |
| 2451 | var a1 = _colorMixin(options); |
| 2452 | var a2 = _fontMixin(options); |
| 2453 | if (a1[0] && a1[0].a > 0) { |
| 2454 | var f = a1[0]._get(); |
| 2455 | if (_ctx.state._fill != f) { |
| 2456 | _ctx.fillStyle = _ctx.state._fill = f; |
| 2457 | } |
| 2458 | _ctx_font(a2[0], a2[1], a2[2]); |
| 2459 | var lines = str.toString().split("\n"); |
| 2460 | for (var i=0; i<lines.length; i++) { |
| 2461 | _ctx.fillText(lines[i], x, y + i*a2[1]*a2[3]); |
| 2462 | } |
| 2463 | } |
| 2464 | } |
| 2465 | |
| 2466 | function textmetrics(str, options) { |
| 2467 | /* Returns array [width, height] for the given text. |
nothing calls this directly
no test coverage detected
searching dependent graphs…