MCPcopy
hub / github.com/libgdx/libgdx / GlyphRun

Class GlyphRun

gdx/src/com/badlogic/gdx/graphics/g2d/GlyphLayout.java:586–629  ·  view source on GitHub ↗

Stores glyphs and positions for a line of text. @author Nathan Sweet

Source from the content-addressed store, hash-verified

584 /** Stores glyphs and positions for a line of text.
585 * @author Nathan Sweet */
586 static public class GlyphRun implements Poolable {
587 public Array<Glyph> glyphs = new Array();
588
589 /** Contains glyphs.size+1 entries:<br>
590 * The first entry is the X offset relative to the drawing position.<br>
591 * Subsequent entries are the X advance relative to previous glyph position.<br>
592 * The last entry is the width of the last glyph. */
593 public FloatArray xAdvances = new FloatArray();
594
595 public float x, y, width;
596
597 public WrapState wrapState;
598
599 void appendRun (GlyphRun run) {
600 glyphs.addAll(run.glyphs);
601 // Remove the width of the last glyph. The first xadvance of the appended run has kerning for the last glyph of this run.
602 if (xAdvances.notEmpty()) xAdvances.size--;
603 xAdvances.addAll(run.xAdvances);
604 }
605
606 public void reset () {
607 glyphs.clear();
608 xAdvances.clear();
609 wrapState = WrapState.notWrapped;
610 }
611
612 public String toString () {
613 StringBuilder buffer = new StringBuilder(glyphs.size + 32);
614 Array<Glyph> glyphs = this.glyphs;
615 for (int i = 0, n = glyphs.size; i < n; i++) {
616 Glyph g = glyphs.get(i);
617 buffer.append((char)g.id);
618 }
619 buffer.append(", ");
620 buffer.append(x);
621 buffer.append(", ");
622 buffer.append(y);
623 buffer.append(", ");
624 buffer.append(width);
625 buffer.append(", ");
626 buffer.append(wrapState);
627 return buffer.toString();
628 }
629 }
630}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected