MCPcopy Index your code
hub / github.com/benfry/processing4 / textWidthImpl

Method textWidthImpl

core/src/processing/core/PGraphics.java:4627–4634  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

4625 * return the size not of a 1 pixel font, but the actual current size.
4626 */
4627 protected float textWidthImpl(char[] buffer, int start, int stop) {
4628 float wide = 0;
4629 for (int i = start; i < stop; i++) {
4630 // could add kerning here, but it just ain't implemented
4631 wide += textFont.width(buffer[i]) * textSize;
4632 }
4633 return wide;
4634 }
4635
4636
4637 // ........................................................

Callers 3

textWidthMethod · 0.95
textSentenceMethod · 0.95
textLineAlignImplMethod · 0.95

Calls 1

widthMethod · 0.80

Tested by

no test coverage detected