Implementation of returning the text width of the chars [start, stop) in the buffer. Unlike the previous version that was inside PFont, this will return the size not of a 1 pixel font, but the actual current size.
(char buffer[], int start, int stop)
| 4552 | * return the size not of a 1 pixel font, but the actual current size. |
| 4553 | */ |
| 4554 | protected float textWidthImpl(char buffer[], int start, int stop) { |
| 4555 | float wide = 0; |
| 4556 | for (int i = start; i < stop; i++) { |
| 4557 | // could add kerning here, but it just ain't implemented |
| 4558 | wide += textFont.width(buffer[i]) * textSize; |
| 4559 | } |
| 4560 | return wide; |
| 4561 | } |
| 4562 | |
| 4563 | |
| 4564 | // ........................................................ |
no test coverage detected