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.
Description
Section titled “Description”GlyphTextRenderer creates one per drawn character, passes it to the text effects, then to its drawGlyph hook.
Learn more
Section titled “Learn more”Creation
Section titled “Creation”| Returns | Signature | Summary |
|---|---|---|
TextGlyph<F> | create(GlyphFont | 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. |
Properties
Section titled “Properties”| Property | Type | Default | Summary |
|---|---|---|---|
| codepoint | int | set at creation | The character that the glyph draws: getCodepoint() reads it, codepoint(int) replaces it. |
| color | Color | set at creation | The color the glyph draws in: getColor() reads it, color(Color) replaces it. |
Methods
Section titled “Methods”Position and size
Section titled “Position and size”| Returns | Signature | Summary |
|---|---|---|
double | getX() | Returns the left edge of the glyph, before its offset. |
double | getSize() | Returns the font size of the glyph, in design pixels. |
Queries
Section titled “Queries”| Returns | Signature | Summary |
|---|---|---|
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 | 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. |
double | getAdvance() | Returns the distance from this glyph to the next one. |
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. |
Actions
Section titled “Actions”| Returns | Signature | Summary |
|---|---|---|
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. |
Creation details
Section titled “Creation details”create
Section titled “create”<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.
Property details
Section titled “Property details”codepoint
Section titled “codepoint”this codepoint(int codepoint)fluentint getCodepoint()
Default: set at creation
The character that the glyph draws: getCodepoint() reads it, codepoint(int) replaces it.
this color(Color color)fluentColor getColor()
Default: set at creation
The color the glyph draws in: getColor() reads it, color(Color) replaces it.
Method details
Section titled “Method details”double getX()
Returns the left edge of the glyph, before its offset.
getSize
Section titled “getSize”double getSize()
Returns the font size of the glyph, in design pixels.
isSlanted
Section titled “isSlanted”boolean isSlanted()
If true, the style is italic and the face is not, so the renderer slants the glyph by itself.
getAdvance
Section titled “getAdvance”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.
getAscender
Section titled “getAscender”double getAscender()
Returns the ascender of the face at the size of the glyph.
getDescender
Section titled “getDescender”double getDescender()
Returns the descender of the face at the size of the glyph, negative below the baseline.
getUnderlineY
Section titled “getUnderlineY”double getUnderlineY()
Returns the y where an underline of the face sits.
getUnderlineThickness
Section titled “getUnderlineThickness”double getUnderlineThickness()
Returns the thickness of an underline of the face at the size of the glyph.
hasGlyph
Section titled “hasGlyph”boolean hasGlyph(int codepoint)
If true, the face can draw codepoint.
getFace
Section titled “getFace”F getFace()
Returns the IFontFace that draws the glyph.
getIndex
Section titled “getIndex”int getIndex()
Returns the index of the glyph’s character in the string, markup tags included.
isShadow
Section titled “isShadow”boolean isShadow()
If true, this glyph is the shadow copy of another one.
getBaseline
Section titled “getBaseline”double getBaseline()
Returns the y of the baseline of the glyph.
getStyle
Section titled “getStyle”TextStyle getStyle()
Returns the TextStyle the glyph was laid out with.
getFont
Section titled “getFont”GlyphFont<F> getFont()
Returns the GlyphFont the glyph comes from.
getOffsetX
Section titled “getOffsetX”double getOffsetX()
Returns the horizontal offset that the effects gave the glyph.
getOffsetY
Section titled “getOffsetY”double getOffsetY()
Returns the vertical offset that the effects gave the glyph.
shadow
Section titled “shadow”TextGlyph<F> shadow(double x, double y, Color color)
Returns the shadow copy of this glyph, moved by x, y and drawn in color.
offset
Section titled “offset”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
