Class Font
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public enumFont.WeightEnum representing weights available to a font in PolyUI.
-
Field Summary
Fields Modifier and Type Field Description private final Stringnameprivate final FloatletterSpacingprivate final FloatlineSpacingprivate final FontFamilyfamilyprivate final Booleanitalicprivate final Font.Weightweightprivate final StringresourcePathprivate final BooleanloadSync
-
Constructor Summary
Constructors Constructor Description Font(String resourcePath, Float letterSpacing, Float lineSpacing, FontFamily family, Boolean italic, Font.Weight weight)Font(String resourcePath, Float letterSpacing, Float lineSpacing, FontFamily family, Boolean italic)Font(String resourcePath, Float letterSpacing, Float lineSpacing, FontFamily family)Font(String resourcePath, Float letterSpacing, Float lineSpacing)Font(String resourcePath, Float letterSpacing)Font(String resourcePath)
-
Method Summary
Modifier and Type Method Description final StringgetName()final FloatgetLetterSpacing()final FloatgetLineSpacing()final FontFamilygetFamily()final BooleangetItalic()final Font.WeightgetWeight()final FontgetAtStyle(Font.Weight weight, Boolean italic)IntegerhashCode()Booleanequals(Object other)final static FontgetGoogleFont(String family, String style, Float letterSpacing, Float lineSpacing, Boolean verify)Get a font from the Google Fonts repository on GitHub. final static FontgetGoogleFont(String family, String style, Float letterSpacing, Float lineSpacing)Get a font from the Google Fonts repository on GitHub. final static FontgetGoogleFont(String family, String style, Float letterSpacing)Get a font from the Google Fonts repository on GitHub. final static FontgetGoogleFont(String family, String style)Get a font from the Google Fonts repository on GitHub. final static Font.WeightbyWeight(Integer weight)Get a Weight instance given the integer weight, as specified by the Google Fonts CSS v2 API. -
Methods inherited from class org.polyfrost.polyui.renderer.data.Resource
getResourcePath, load, load, loadAsync, loadAsync, loadAsyncDirect, loadAsyncDirectNT, loadDirect, loadDirectNT, shouldLoadSync, stream, toString -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Constructor Detail
-
Font
Font(String resourcePath, Float letterSpacing, Float lineSpacing, FontFamily family, Boolean italic, Font.Weight weight)
- Parameters:
resourcePath- The resource of the font, can be a URL (see here, you should use this or an equivalent method)letterSpacing- The letter spacing of the font, in pixels (e.g.lineSpacing- The line spacing of the font, in proportion to the font size (e.g.family- a reference to the family that encloses this font.
-
Font
Font(String resourcePath, Float letterSpacing, Float lineSpacing, FontFamily family, Boolean italic)
- Parameters:
resourcePath- The resource of the font, can be a URL (see here, you should use this or an equivalent method)letterSpacing- The letter spacing of the font, in pixels (e.g.lineSpacing- The line spacing of the font, in proportion to the font size (e.g.family- a reference to the family that encloses this font.
-
Font
Font(String resourcePath, Float letterSpacing, Float lineSpacing, FontFamily family)
- Parameters:
resourcePath- The resource of the font, can be a URL (see here, you should use this or an equivalent method)letterSpacing- The letter spacing of the font, in pixels (e.g.lineSpacing- The line spacing of the font, in proportion to the font size (e.g.family- a reference to the family that encloses this font.
-
Font
Font(String resourcePath, Float letterSpacing, Float lineSpacing)
- Parameters:
resourcePath- The resource of the font, can be a URL (see here, you should use this or an equivalent method)letterSpacing- The letter spacing of the font, in pixels (e.g.lineSpacing- The line spacing of the font, in proportion to the font size (e.g.
-
Font
Font(String resourcePath, Float letterSpacing)
- Parameters:
resourcePath- The resource of the font, can be a URL (see here, you should use this or an equivalent method)letterSpacing- The letter spacing of the font, in pixels (e.g.
-
Font
Font(String resourcePath)
- Parameters:
resourcePath- The resource of the font, can be a URL (see here, you should use this or an equivalent method)
-
-
Method Detail
-
getLetterSpacing
final Float getLetterSpacing()
-
getLineSpacing
final Float getLineSpacing()
-
getFamily
final FontFamily getFamily()
-
getWeight
final Font.Weight getWeight()
-
getAtStyle
final Font getAtStyle(Font.Weight weight, Boolean italic)
-
getGoogleFont
@JvmOverloads() final static Font getGoogleFont(String family, String style, Float letterSpacing, Float lineSpacing, Boolean verify)
Get a font from the Google Fonts repository on GitHub.
Note that each font has a different licence, so it's best to check the licence for your usage.
Set verify to
trueto attempt to connect to the mirror in this method for a better error message.- Parameters:
family- the name of the font, for examplepoppinsorroboto.style- the style of the font.- Since:
0.16.0
-
getGoogleFont
@JvmOverloads() final static Font getGoogleFont(String family, String style, Float letterSpacing, Float lineSpacing)
Get a font from the Google Fonts repository on GitHub.
Note that each font has a different licence, so it's best to check the licence for your usage.
Set verify to
trueto attempt to connect to the mirror in this method for a better error message.- Parameters:
family- the name of the font, for examplepoppinsorroboto.style- the style of the font.- Since:
0.16.0
-
getGoogleFont
@JvmOverloads() final static Font getGoogleFont(String family, String style, Float letterSpacing)
Get a font from the Google Fonts repository on GitHub.
Note that each font has a different licence, so it's best to check the licence for your usage.
Set verify to
trueto attempt to connect to the mirror in this method for a better error message.- Parameters:
family- the name of the font, for examplepoppinsorroboto.style- the style of the font.- Since:
0.16.0
-
getGoogleFont
@JvmOverloads() final static Font getGoogleFont(String family, String style)
Get a font from the Google Fonts repository on GitHub.
Note that each font has a different licence, so it's best to check the licence for your usage.
Set verify to
trueto attempt to connect to the mirror in this method for a better error message.- Parameters:
family- the name of the font, for examplepoppinsorroboto.style- the style of the font.- Since:
0.16.0
-
byWeight
final static Font.Weight byWeight(Integer weight)
Get a Weight instance given the integer weight, as specified by the Google Fonts CSS v2 API.
Weights that are not whole numbers will be floored to the nearest 100.
- Since:
1.0.7
-
-
-
-