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

Method addGlyph

core/src/processing/core/PFont.java:459–496  ·  view source on GitHub ↗

Create a new glyph, and add the character to the current font. @param c character to create an image for.

(char c)

Source from the content-addressed store, hash-verified

457 * @param c character to create an image for.
458 */
459 protected void addGlyph(char c) {
460 Glyph glyph = new Glyph(c);
461
462 if (glyphCount == glyphs.length) {
463 glyphs = (Glyph[]) PApplet.expand(glyphs);
464 }
465 if (glyphCount == 0) {
466 glyph.index = 0;
467 glyphs[glyphCount] = glyph;
468 if (glyph.value < 128) {
469 ascii[glyph.value] = 0;
470 }
471
472 } else if (glyphs[glyphCount-1].value < glyph.value) {
473 glyphs[glyphCount] = glyph;
474 if (glyph.value < 128) {
475 ascii[glyph.value] = glyphCount;
476 }
477
478 } else {
479 for (int i = 0; i < glyphCount; i++) {
480 if (glyphs[i].value > c) {
481 for (int j = glyphCount; j > i; --j) {
482 glyphs[j] = glyphs[j-1];
483 if (glyphs[j].value < 128) {
484 ascii[glyphs[j].value] = j;
485 }
486 }
487 glyph.index = i;
488 glyphs[i] = glyph;
489 // cache locations of the ascii charset
490 if (c < 128) ascii[c] = i;
491 break;
492 }
493 }
494 }
495 glyphCount++;
496 }
497
498
499 public String getName() {

Callers 1

indexMethod · 0.95

Calls 1

expandMethod · 0.95

Tested by

no test coverage detected