MCPcopy Index your code
hub / github.com/processing/processing / textWidthImpl

Method textWidthImpl

core/src/processing/core/PGraphics.java:4554–4561  ·  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

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 // ........................................................

Callers 3

textWidthMethod · 0.95
textSentenceMethod · 0.95
textLineAlignImplMethod · 0.95

Calls 1

widthMethod · 0.80

Tested by

no test coverage detected