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

Method addGlyph

core/src/processing/core/PFont.java:452–489  ·  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

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

Callers 1

indexMethod · 0.95

Calls 1

expandMethod · 0.95

Tested by

no test coverage detected