Package com.atlassian.bamboo.captcha
Class AtlassianRandomFontGenerator
- java.lang.Object
-
- com.atlassian.bamboo.captcha.AtlassianRandomFontGenerator
-
- All Implemented Interfaces:
com.octo.captcha.component.image.fontgenerator.FontGenerator
public class AtlassianRandomFontGenerator extends Object implements com.octo.captcha.component.image.fontgenerator.FontGenerator
-
-
Constructor Summary
Constructors Constructor Description AtlassianRandomFontGenerator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Font
applyRandomStyle(Font font)
Font
getFont()
int
getMaxFontSize()
int
getMinFontSize()
protected @NotNull List<Font>
getRandomFontsForCaptchas(Iterable<Font> uncheckedFonts, int fontsToReturn)
Create list of fonts that are not blacklisted for captcha and can display all requiredCharacters.
-
-
-
Method Detail
-
getFont
public Font getFont()
- Specified by:
getFont
in interfacecom.octo.captcha.component.image.fontgenerator.FontGenerator
- Returns:
- a random Font from the pool
-
getMinFontSize
public int getMinFontSize()
- Specified by:
getMinFontSize
in interfacecom.octo.captcha.component.image.fontgenerator.FontGenerator
-
getMaxFontSize
public int getMaxFontSize()
- Specified by:
getMaxFontSize
in interfacecom.octo.captcha.component.image.fontgenerator.FontGenerator
-
getRandomFontsForCaptchas
@NotNull protected @NotNull List<Font> getRandomFontsForCaptchas(Iterable<Font> uncheckedFonts, int fontsToReturn)
Create list of fonts that are not blacklisted for captcha and can display all requiredCharacters. This method will not return more than fontsToReturn to avoid a problem of OS X - every font checked by canDisplay() remains open 'forever'.- Parameters:
uncheckedFonts
- fonts to validate for captcha usagefontsToReturn
- return at least that many fonts- Returns:
- list of fonts
- See Also:
REQUIRED_CHARACTERS
-
-