* @ignore
(context, text, x, y)
| 468 | * @ignore |
| 469 | */ |
| 470 | _drawFont(context, text, x, y) { |
| 471 | setContextStyle(context, this); |
| 472 | |
| 473 | let remaining = this.visibleCharacters; |
| 474 | |
| 475 | for (let i = 0; i < text.length; i++) { |
| 476 | let string = text[i].trimEnd(); |
| 477 | |
| 478 | // limit visible characters if needed |
| 479 | if (remaining !== -1) { |
| 480 | if (remaining <= 0) { |
| 481 | break; |
| 482 | } |
| 483 | string = string.substring(0, remaining); |
| 484 | remaining -= string.length; |
| 485 | } |
| 486 | |
| 487 | // draw the string |
| 488 | if (this.fillStyle.alpha > 0) { |
| 489 | context.fillText(string, x, y); |
| 490 | } |
| 491 | // stroke the text |
| 492 | if (this.lineWidth > 0 && this.strokeStyle.alpha > 0) { |
| 493 | context.strokeText(string, x, y); |
| 494 | } |
| 495 | // add leading space |
| 496 | y += this.metrics.lineHeight(); |
| 497 | } |
| 498 | return this.metrics; |
| 499 | } |
| 500 | |
| 501 | /** |
| 502 | * Destroy function |
no test coverage detected