Skip to content

FontFamily

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

The faces of one font, by weight and style, from which a text picks the face it draws with.

A GlyphFont holds one family; MsdfFontLoader builds it for you from the files you load.

ReturnsSignatureSummary
FontFamily<F>of(F… faces) factoryCreates a family of faces, sorted by weight.

ReturnsSignatureSummary
Fresolve(FontWeight weight, boolean italic)Returns the face for weight and italic: among the faces of that style, or all faces when none has it, the closest weight.
List<F>getFaces()Returns the faces, sorted by weight, as a list you cannot change.

<F extends IFontFace> FontFamily<F> of(F... faces) factory

Throws:

  • IllegalArgumentException: A font family needs at least one face, got none: pass its faces to FontFamily.of(…)
  • IllegalArgumentException: Two faces share the weight …, keep one face per weight and style

Creates a family of faces, sorted by weight. Throws IllegalArgumentException when no face is given or when two faces share a weight and a style.

F resolve(FontWeight weight, boolean italic)

Returns the face for weight and italic: among the faces of that style, or all faces when none has it, the closest weight. For a requested weight of 400 or above 500, the heavier of two equally close faces wins; otherwise the lighter one. A weight that the family does not have warns once in dev mode and names the loaded faces.

List<F> getFaces()

Returns the faces, sorted by weight, as a list you cannot change.


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