Interface FontLoader
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Installed by the backend through Fonts.installLoader(limn.graphics.FontLoader); UNAVAILABLE is the
headless default, and it refuses rather than pretending a family exists.
This is the only way a face that is neither bundled in the backend nor installed in the operating system can enter the font stack. Without it an application that ships its own typeface has to ask the user to install it, and a capture or test that names such a family silently gets the default face instead, a difference nothing downstream can see.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final FontLoaderNo backend / headless: there is nothing that can parse a font file. -
Method Summary
-
Field Details
-
UNAVAILABLE
No backend / headless: there is nothing that can parse a font file.
-
-
Method Details
-
load
Reads the faces in one font file and registers them under their own family name.Synchronous, and on the calling thread. What is read here is the file's name table (the family and style strings, kilobytes), not its glyphs; those are parsed on first use, the same way an operating-system face is. Registration has to complete before it returns, because the caller's next act is to name the family in a widget or in
Fonts.setDefaultFamily(java.lang.String), and a family that is not registered yet resolves to the default face.- Parameters:
file- font file (TrueType, OpenType, or a collection); a relative path resolves against the process working directory- Returns:
- the family name the faces registered under; pass this to
Fonts.setDefaultFamily(java.lang.String)or toFont, rather than assuming the name from the file name, which need not match what the file declares - Throws:
UncheckedIOException- if the file cannot be readIllegalArgumentException- if it carries no usable faceUnsupportedOperationException- if no backend is installed
-