Class TextBlob.Builder

java.lang.Object
icyllis.arc3d.core.TextBlob.Builder
Enclosing class:
TextBlob

public static final class TextBlob.Builder extends Object
Helper class for constructing TextBlob.
  • Constructor Details

    • Builder

      public Builder()
      Constructs empty TextBlobBuilder. By default, TextBlobBuilder has no runs.
  • Method Details

    • allocRunPos

      @Nonnull public TextBlob.Builder.RunBuffer allocRunPos(@Nonnull Font font, int count, @Nullable Rect2fc bounds)
      Returns run with storage for glyphs and positions. Caller must write count glyphs and count positions to TextBlob.Builder.RunBuffer before next call to TextBlobBuilder.

      Glyphs share metrics in font.

      Glyphs are positioned using positions written by caller to RunBuffer, using two float values for each position.

      bounds defines an optional bounding box, used to skip drawing when TextBlob bounds does not intersect Canvas bounds. If bounds is null, TextBlob bounds is computed from positions, and glyphs metrics.

      Parameters:
      font - Font used for this run
      count - number of glyphs
      bounds - optional run bounding box
      Returns:
      writable glyph buffer and position buffer
    • build

      @Nullable public TextBlob build()
      Returns TextBlob built from runs of glyphs added by builder. Returned TextBlob is immutable; its contents may not be altered. Returns null if no runs of glyphs were added by builder.

      Resets TextBlobBuilder to its initial empty state, allowing it to be reused to build a new set of runs.

      Returns:
      TextBlob or null