Skip to content

ITextEffect

interface ITextEffect
Package: dev.joid.lib.font.effect · Module: core · Source: ITextEffect.java

An effect on the glyphs of a text, which can move, recolor or replace each glyph and draw behind or over it.

Give effects to a TextInfo with effects(...), or add them from a markup tag with TextStyle.effect. JOID calls the three hooks for every glyph, on the render thread, in this order: apply for each glyph, then background, then the glyphs are drawn, then decorate. A shadow glyph goes through decorate only: test ITextGlyph.isShadow there to skip it.

ReturnsSignatureSummary
voidapply(ITextGlyph glyph) hook defaultJOID calls it once per glyph before anything is drawn.
voidbackground(ITextGlyph glyph) hook defaultJOID calls it once per glyph after apply, before the glyphs are drawn: draw a highlight or a box behind the glyph, in design pixels, with DrawUtils.
voiddecorate(ITextGlyph glyph) hook defaultJOID calls it once per glyph after the glyphs are drawn: draw an underline, a strike-through or a cursor over the glyph.

void apply(ITextGlyph glyph) hook default

JOID calls it once per glyph before anything is drawn. Change the glyph there: its offset, its color or its codepoint; reading ITextGlyph.getIndex and the clock gives per-character animations such as a wave.

void background(ITextGlyph glyph) hook default

JOID calls it once per glyph after apply, before the glyphs are drawn: draw a highlight or a box behind the glyph, in design pixels, with DrawUtils.

void decorate(ITextGlyph glyph) hook default

JOID calls it once per glyph after the glyphs are drawn: draw an underline, a strike-through or a cursor over the glyph.


fluent returns the instance, typed for chaining · factory creates an instance · signal also accepts a value that follows signals, as a signal, an expression or a lambda (When does JOID compute this value again?) · hook called by JOID, override it · abstract you implement it · default interface method with a body · static called on the class · protected visible to subclasses

Report a problem with this page