Package org.zaproxy.zap.utils
Class FontUtils
- java.lang.Object
-
- org.zaproxy.zap.utils.FontUtils
-
public class FontUtils extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
FontUtils.FontType
static class
FontUtils.Size
-
Constructor Summary
Constructors Constructor Description FontUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static boolean
canChangeSize()
static java.awt.Font
getFont(int style)
Gets the default font with the specified style, correctly scaledstatic java.awt.Font
getFont(int style, FontUtils.Size size)
Gets the default font with the specified style and size, correctly scaledstatic java.awt.Font
getFont(java.awt.Font font, int style, FontUtils.Size size)
Gets the specified font with the specified style and size, correctly scaledstatic java.awt.Font
getFont(java.awt.Font font, FontUtils.Size size)
Gets the specified font with the specified size, correctly scaledstatic java.awt.Font
getFont(java.lang.String name)
Gets the named font, correctly scaledstatic java.awt.Font
getFont(java.lang.String name, int style)
Gets the named font with the specified style, correctly scaledstatic java.awt.Font
getFont(FontUtils.FontType fontType)
Gets the font for the giveFontUtils.FontType
static java.awt.Font
getFont(FontUtils.Size size)
Gets the default font with the specified size, correctly scaledstatic java.awt.Font
getFontWithFallback(FontUtils.FontType fontType, java.lang.String fallbackFontName)
Gets font for the givenFontUtils.FontType
or the fallback font with the given name if no font is set for the givenFontType
static java.awt.Font
getQuicksandBoldFont()
Returns the Quicksand Bold font - https://fonts.google.com/specimen/Quicksand?selection.family=Quicksandstatic float
getScale()
static java.awt.Font
getSystemDefaultFont()
static boolean
isDefaultFontSet()
Tells whether or not a custom default font was set.static boolean
isDefaultFontSet(FontUtils.FontType fontType)
Tells whether or not a custom default font was set for the givenFontUtils.FontType
.static void
setDefaultFont(FontUtils.FontType fontType, java.awt.Font font)
static void
setDefaultFont(FontUtils.FontType fontType, java.lang.String name, int size)
-
-
-
Method Detail
-
getSystemDefaultFont
public static java.awt.Font getSystemDefaultFont()
-
getQuicksandBoldFont
public static java.awt.Font getQuicksandBoldFont()
Returns the Quicksand Bold font - https://fonts.google.com/specimen/Quicksand?selection.family=Quicksand- Returns:
- the Quicksand Bold font
- Since:
- 2.7.0
-
canChangeSize
public static boolean canChangeSize()
-
setDefaultFont
public static void setDefaultFont(FontUtils.FontType fontType, java.awt.Font font)
-
setDefaultFont
public static void setDefaultFont(FontUtils.FontType fontType, java.lang.String name, int size)
-
getFont
public static java.awt.Font getFont(java.lang.String name)
Gets the named font, correctly scaled- Parameters:
name
-- Returns:
- the named font, correctly scaled
-
getFont
public static java.awt.Font getFont(int style)
Gets the default font with the specified style, correctly scaled- Parameters:
style
-- Returns:
- the default font with the specified style, correctly scaled
-
getFont
public static java.awt.Font getFont(FontUtils.FontType fontType)
Gets the font for the giveFontUtils.FontType
- Parameters:
fontType
- theFontType
for which the font should be returned- Returns:
- font
-
getFontWithFallback
public static java.awt.Font getFontWithFallback(FontUtils.FontType fontType, java.lang.String fallbackFontName)
Gets font for the givenFontUtils.FontType
or the fallback font with the given name if no font is set for the givenFontType
- Parameters:
fontType
- theFontType
for which the font should be returnedfallbackFontName
- the name (String
) of the font which will be returned of no font is set for the givenFontType
- Returns:
- work panels font or fallback font
-
getFont
public static java.awt.Font getFont(java.lang.String name, int style)
Gets the named font with the specified style, correctly scaled- Parameters:
name
-style
-- Returns:
- the named font with the specified style, correctly scaled
-
getFont
public static java.awt.Font getFont(int style, FontUtils.Size size)
Gets the default font with the specified style and size, correctly scaled- Parameters:
style
-size
-- Returns:
-
getFont
public static java.awt.Font getFont(java.awt.Font font, int style, FontUtils.Size size)
Gets the specified font with the specified style and size, correctly scaled- Parameters:
style
-size
-- Returns:
- Since:
- 2.7.0
-
getFont
public static java.awt.Font getFont(FontUtils.Size size)
Gets the default font with the specified size, correctly scaled- Parameters:
size
-- Returns:
- the default font with the specified size, correctly scaled
-
getFont
public static java.awt.Font getFont(java.awt.Font font, FontUtils.Size size)
Gets the specified font with the specified size, correctly scaled- Parameters:
font
-size
-- Returns:
- the specified font with the specified size, correctly scaled
- Since:
- 2.7.0
-
getScale
public static float getScale()
-
isDefaultFontSet
public static boolean isDefaultFontSet()
Tells whether or not a custom default font was set.If no custom font was set it's used the system default font.
- Returns:
true
if a custom font was set,false
otherwise.- Since:
- 2.7.0
- See Also:
getSystemDefaultFont()
-
isDefaultFontSet
public static boolean isDefaultFontSet(FontUtils.FontType fontType)
Tells whether or not a custom default font was set for the givenFontUtils.FontType
.- Returns:
true
if a custom font was set,false
otherwise.- Since:
- 2.8.0
- See Also:
getSystemDefaultFont()
-
-