Skip to content

MsdfFontFace

final class MsdfFontFace
Implements: IFontFace
Package: dev.joid.lib.font.impl.msdf · Module: core · Source: MsdfFontFace.java

One face of an MsdfFont, with its atlas texture, its metrics, its glyphs and its kerning.

An IMsdfSource reads it; MsdfFontLoader does that for you. Metrics, advances and kerning are on 1 of the font size.

ReturnsSignatureSummary
MsdfFontFaceof(MsdfAtlas atlas, MsdfMetrics metrics, Map<Integer,MsdfGlyph> glyphs, Map<Long,Float> kerningPairs, BufferedImage image, String name, FontWeight weight, boolean italic) factoryCreates a face from its atlas, its metrics, its glyphs by codepoint, its kerning pairs keyed by pair(previous, current), the atlas image, its name, its weight and its style.

ReturnsSignatureSummary
floatgetAscender()Returns the ascender of the face, on 1 of the font size.
floatgetDescender()Returns the descender of the face, on 1 of the font size, negative below the baseline.
floatgetLineHeight()Returns the line height of the face, on 1 of the font size.
floatgetUnderlineY()Returns the position of an underline relative to the baseline, on 1 of the font size.
floatgetUnderlineThickness()Returns the thickness of an underline, on 1 of the font size.
floatgetAdvance(int codepoint)Returns the advance of codepoint, on 1 of the font size, 0F for a codepoint the face does not have.
floatgetKerning(int previous, int current)Returns the kerning between previous and current, on 1 of the font size, 0F for none.
booleanhasGlyph(int codepoint)If true, the face has a glyph for codepoint, a space included.
MsdfGlyphgetGlyph(int codepoint)Returns the MsdfGlyph of codepoint, or null when the face does not have it.
Map<Integer,MsdfGlyph>getGlyphs()Returns the glyphs by codepoint, as a map you cannot change.
Map<Long,Float>getKerningPairs()Returns the kerning by pair of codepoints, keyed by pair(previous, current), as a map you cannot change.
StringgetName()Returns the name of the font of this face.
floatgetXHeight()Returns the height of a lowercase x, on 1 of the font size, 0F when the face has none.
booleanisItalic()If true, the face is italic.
MsdfAtlasgetAtlas()Returns the size and the distance range of the atlas.
ResourcegetTexture()Returns the atlas as a Resource.
FontWeightgetWeight()Returns the weight of the face.
MsdfMetricsgetMetrics()Returns the vertical metrics of the face.
ReturnsSignatureSummary
longpair(int previous, int current) staticReturns the key of the kerning pair previous, current in getKerningPairs().
MsdfFontFacestyle(FontWeight weight, boolean italic)Returns the same face, sharing its atlas and glyphs, declared with another weight and style.

MsdfFontFace of(MsdfAtlas atlas, MsdfMetrics metrics, Map<Integer,MsdfGlyph> glyphs, Map<Long,Float> kerningPairs, BufferedImage image, String name, FontWeight weight, boolean italic) factory

Throws:

  • IllegalArgumentException: A font face needs a name, got an empty one: give the face the name of its font

Creates a face from its atlas, its metrics, its glyphs by codepoint, its kerning pairs keyed by pair(previous, current), the atlas image, its name, its weight and its style. The image becomes a linear texture without mipmaps, uploaded the first time the face draws. Throws IllegalArgumentException when name is empty.

float getAscender()

Returns the ascender of the face, on 1 of the font size.

float getDescender()

Returns the descender of the face, on 1 of the font size, negative below the baseline.

float getLineHeight()

Returns the line height of the face, on 1 of the font size.

float getUnderlineY()

Returns the position of an underline relative to the baseline, on 1 of the font size.

float getUnderlineThickness()

Returns the thickness of an underline, on 1 of the font size.

float getAdvance(int codepoint)

Returns the advance of codepoint, on 1 of the font size, 0F for a codepoint the face does not have.

float getKerning(int previous, int current)

Returns the kerning between previous and current, on 1 of the font size, 0F for none.

boolean hasGlyph(int codepoint)

If true, the face has a glyph for codepoint, a space included.

MsdfGlyph getGlyph(int codepoint)

Returns the MsdfGlyph of codepoint, or null when the face does not have it.

Map<Integer,MsdfGlyph> getGlyphs()

Returns the glyphs by codepoint, as a map you cannot change.

Map<Long,Float> getKerningPairs()

Returns the kerning by pair of codepoints, keyed by pair(previous, current), as a map you cannot change.

String getName()

Returns the name of the font of this face.

float getXHeight()

Returns the height of a lowercase x, on 1 of the font size, 0F when the face has none.

boolean isItalic()

If true, the face is italic.

MsdfAtlas getAtlas()

Returns the size and the distance range of the atlas.

Resource getTexture()

Returns the atlas as a Resource.

FontWeight getWeight()

Returns the weight of the face.

MsdfMetrics getMetrics()

Returns the vertical metrics of the face.

long pair(int previous, int current) static

Returns the key of the kerning pair previous, current in getKerningPairs().

MsdfFontFace style(FontWeight weight, boolean italic)

Returns the same face, sharing its atlas and glyphs, declared with another weight and style.


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