com.atlassian.bamboo.captcha
Class AtlassianRandomFontGenerator

java.lang.Object
  extended by com.atlassian.bamboo.captcha.AtlassianRandomFontGenerator
All Implemented Interfaces:
com.octo.captcha.component.image.fontgenerator.FontGenerator

public class AtlassianRandomFontGenerator
extends java.lang.Object
implements com.octo.captcha.component.image.fontgenerator.FontGenerator


Constructor Summary
AtlassianRandomFontGenerator()
           
 
Method Summary
protected  java.awt.Font applyRandomStyle(java.awt.Font font)
           
 java.awt.Font getFont()
           
 int getMaxFontSize()
           
 int getMinFontSize()
           
protected  java.util.List<java.awt.Font> getRandomFontsForCaptchas(java.lang.Iterable<java.awt.Font> uncheckedFonts, int fontsToReturn)
          Create list of fonts that are not blacklisted for captcha and can display all requiredCharacters.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AtlassianRandomFontGenerator

public AtlassianRandomFontGenerator()
Method Detail

getFont

public java.awt.Font getFont()
Specified by:
getFont in interface com.octo.captcha.component.image.fontgenerator.FontGenerator
Returns:
a random Font from the pool

getMinFontSize

public int getMinFontSize()
Specified by:
getMinFontSize in interface com.octo.captcha.component.image.fontgenerator.FontGenerator

getMaxFontSize

public int getMaxFontSize()
Specified by:
getMaxFontSize in interface com.octo.captcha.component.image.fontgenerator.FontGenerator

applyRandomStyle

protected java.awt.Font applyRandomStyle(java.awt.Font font)

getRandomFontsForCaptchas

@NotNull
protected java.util.List<java.awt.Font> getRandomFontsForCaptchas(java.lang.Iterable<java.awt.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 usage
fontsToReturn - return at least that many fonts
Returns:
list of fonts
See Also:
REQUIRED_CHARACTERS


Copyright © 2011 Atlassian. All Rights Reserved.