Skip to content

TextGlyph

final class TextGlyph<F extends IFontFace>
Implements: ITextGlyph
Package: dev.joid.lib.font.impl.glyph · Module: core · Source: TextGlyph.java

The ITextGlyph that a GlyphTextRenderer lays out and draws, with the face and the font it comes from.

GlyphTextRenderer creates one per drawn character, passes it to the text effects, then to its drawGlyph hook.

ReturnsSignatureSummary
TextGlyph<F>create(GlyphFont font, F face, int index, int codepoint, TextStyle style, double x, double baseline, double size, double advance, Color color) factoryCreates a glyph of codepoint at index index of the string, drawn with face of font in style, its left edge at x, on the baseline baseline, at size design pixels, with advance to the next glyph and the color color.

PropertyTypeDefaultSummary
codepointintset at creationThe character that the glyph draws: getCodepoint() reads it, codepoint(int) replaces it.
colorColorset at creationThe color the glyph draws in: getColor() reads it, color(Color) replaces it.

ReturnsSignatureSummary
doublegetX()Returns the left edge of the glyph, before its offset.
doublegetSize()Returns the font size of the glyph, in design pixels.
ReturnsSignatureSummary
booleanisSlanted()If true, the style is italic and the face is not, so the renderer slants the glyph by itself.
doublegetAdvance(int codepoint)Returns the advance of codepoint in the face, at the size of the glyph.
doublegetAscender()Returns the ascender of the face at the size of the glyph.
doublegetDescender()Returns the descender of the face at the size of the glyph, negative below the baseline.
doublegetUnderlineY()Returns the y where an underline of the face sits.
doublegetUnderlineThickness()Returns the thickness of an underline of the face at the size of the glyph.
booleanhasGlyph(int codepoint)If true, the face can draw codepoint.
FgetFace()Returns the IFontFace that draws the glyph.
intgetIndex()Returns the index of the glyph’s character in the string, markup tags included.
doublegetAdvance()Returns the distance from this glyph to the next one.
booleanisShadow()If true, this glyph is the shadow copy of another one.
doublegetBaseline()Returns the y of the baseline of the glyph.
TextStylegetStyle()Returns the TextStyle the glyph was laid out with.
GlyphFont<F>getFont()Returns the GlyphFont the glyph comes from.
doublegetOffsetX()Returns the horizontal offset that the effects gave the glyph.
doublegetOffsetY()Returns the vertical offset that the effects gave the glyph.
ReturnsSignatureSummary
TextGlyph<F>shadow(double x, double y, Color color)Returns the shadow copy of this glyph, moved by x, y and drawn in color.
thisoffset(double x, double y) fluentMoves the glyph by x, y from its place; on the pixel grid the renderer rounds the offset to whole screen pixels.

<F extends IFontFace> TextGlyph<F> create(GlyphFont<F> font, F face, int index, int codepoint, TextStyle style, double x, double baseline, double size, double advance, Color color) factory

Creates a glyph of codepoint at index index of the string, drawn with face of font in style, its left edge at x, on the baseline baseline, at size design pixels, with advance to the next glyph and the color color.

  • this codepoint(int codepoint) fluent
  • int getCodepoint()

Default: set at creation

The character that the glyph draws: getCodepoint() reads it, codepoint(int) replaces it.

  • this color(Color color) fluent
  • Color getColor()

Default: set at creation

The color the glyph draws in: getColor() reads it, color(Color) replaces it.

double getX()

Returns the left edge of the glyph, before its offset.

double getSize()

Returns the font size of the glyph, in design pixels.

boolean isSlanted()

If true, the style is italic and the face is not, so the renderer slants the glyph by itself.

double getAdvance(int codepoint)

Returns the advance of codepoint in the face, at the size of the glyph.

double getAdvance()

Returns the distance from this glyph to the next one.

double getAscender()

Returns the ascender of the face at the size of the glyph.

double getDescender()

Returns the descender of the face at the size of the glyph, negative below the baseline.

double getUnderlineY()

Returns the y where an underline of the face sits.

double getUnderlineThickness()

Returns the thickness of an underline of the face at the size of the glyph.

boolean hasGlyph(int codepoint)

If true, the face can draw codepoint.

F getFace()

Returns the IFontFace that draws the glyph.

int getIndex()

Returns the index of the glyph’s character in the string, markup tags included.

boolean isShadow()

If true, this glyph is the shadow copy of another one.

double getBaseline()

Returns the y of the baseline of the glyph.

TextStyle getStyle()

Returns the TextStyle the glyph was laid out with.

GlyphFont<F> getFont()

Returns the GlyphFont the glyph comes from.

double getOffsetX()

Returns the horizontal offset that the effects gave the glyph.

double getOffsetY()

Returns the vertical offset that the effects gave the glyph.

TextGlyph<F> shadow(double x, double y, Color color)

Returns the shadow copy of this glyph, moved by x, y and drawn in color.

this offset(double x, double y) fluent

Moves the glyph by x, y from its place; on the pixel grid the renderer rounds the offset to whole screen pixels.


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