Skip to content

ITextRenderer

interface ITextRenderer
Known subtypes: GlyphTextRenderer
Package: dev.joid.lib.font · Module: core · Source: ITextRenderer.java

Measures and draws the strings of one kind of font.

DrawText and TextInfo reach it through IFont.getTextRenderer. Implement it for a font that is not made of glyphs; for a font of glyphs, extend GlyphTextRenderer, which lays out, kerns and styles the text for you. Positions and sizes are in design pixels.

ReturnsSignatureSummary
FontBoundsdrawText(double x, double y, String text, TextInfo info) abstractDraws text on one line with its top-left corner at x, y, and returns its bounds.
FontBoundsdrawText(double x, double y, String text, TextInfo info, double runX, double runY, double runWidth, double runHeight) defaultDraws text as a part of a longer run whose box is runX, runY, runWidth, runHeight, so that a gradient spreads over the whole run.
doublegetLineHeight(TextInfo info) abstractReturns the height of one line with info.
doublegetWidth(String text, TextInfo info) abstractReturns the width of text on one line with info, markup tags excluded.
doublegetHeight(String text, TextInfo info) abstractReturns the height of text with info.
doublegetBaseline(TextInfo info) defaultReturns the distance from the top of a line to its baseline with info; the elements of a Text align on it.

FontBounds drawText(double x, double y, String text, TextInfo info) abstract

Draws text on one line with its top-left corner at x, y, and returns its bounds. JOID calls it on the render thread, during a frame.

FontBounds drawText(double x, double y, String text, TextInfo info, double runX, double runY, double runWidth, double runHeight) default

Draws text as a part of a longer run whose box is runX, runY, runWidth, runHeight, so that a gradient spreads over the whole run. By default it ignores the run and calls drawText(x, y, text, info).

double getLineHeight(TextInfo info) abstract

Returns the height of one line with info.

double getWidth(String text, TextInfo info) abstract

Returns the width of text on one line with info, markup tags excluded.

double getHeight(String text, TextInfo info) abstract

Returns the height of text with info.

double getBaseline(TextInfo info) default

Returns the distance from the top of a line to its baseline with info; the elements of a Text align on it. By default, the line height: the baseline sits at the bottom of the line.


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