Package icyllis.arc3d.core
Class TextBlob.Builder
java.lang.Object
icyllis.arc3d.core.TextBlob.Builder
- Enclosing class:
TextBlob
Helper class for constructing TextBlob.
-
Nested Class Summary
Modifier and TypeClassDescriptionfinal class
RunBuffer supplies storage for glyphs and positions within a run. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionallocRunPos
(Font font, int count, Rect2fc bounds) Returns run with storage for glyphs and positions.build()
Returns TextBlob built from runs of glyphs added by builder.
-
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 toTextBlob.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 runcount
- number of glyphsbounds
- optional run bounding box- Returns:
- writable glyph buffer and position buffer
-
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
-