getFontByName

abstract fun getFontByName(@Nullable name: String): Font

Gets the font specified by the given name or null. This function returns fonts for which getName matches (i.e. where the font family name matches) and also fonts where any of the actual font files (including the font style suffix) matches the given font name.


final Font font1 = fontManager.getFontByName("Roboto");
final Font font2 = fontManager.getFontByName("Roboto-Bold");

// This method returns the same font object for both inputs.
assert font1 == font2;

Return

The font of the given name or null if no font for the name exists.

Parameters

name

The name of the font to get. May be null, in which case this method will always return null.