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 -
Method Summary
Modifier and TypeMethodDescriptionprotected Font
applyRandomStyle
(Font font) getFont()
int
int
getRandomFontsForCaptchas
(Iterable<Font> uncheckedFonts, int fontsToReturn) Create list of fonts that are not blacklisted for captcha and can display all requiredCharacters.
-
Constructor Details
-
AtlassianRandomFontGenerator
public AtlassianRandomFontGenerator()
-
-
Method Details
-
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
-
applyRandomStyle
-
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
-