public PdfAppearance getAppearance ( boolean isRadio , boolean on ) throws IOException , DocumentException { if ( isRadio && checkType == TYPE_CIRCLE ) return getAppearanceRadioCircle ( on ) ; PdfAppearance app = getBorderAppearance ( ) ; if ( ! on ) return app ; BaseFont ufont = getRealFont ( ) ; boolean borderExtra = borderStyle == PdfBorderDictionary . STYLE_BEVELED || borderStyle == PdfBorderDictionary . STYLE_INSET ; float h = box . getHeight ( ) - borderWidth * 2 ; float bw2 = borderWidth ; if ( borderExtra ) { h -= borderWidth * 2 ; bw2 *= 2 ; } float offsetX = ( borderExtra ? 2 * borderWidth : borderWidth ) ; offsetX = Math . max ( offsetX , 1 ) ; float offX = Math . min ( bw2 , offsetX ) ; float wt = box . getWidth ( ) - 2 * offX ; float ht = box . getHeight ( ) - 2 * offX ; float fsize = fontSize ; if ( fsize == 0 ) { float bw = ufont . getWidthPoint ( text , 1 ) ; if ( bw == 0 ) fsize = 12 ; else fsize = wt / bw ; float nfsize = h / ( ufont . getFontDescriptor ( BaseFont . ASCENT , 1 ) ) ; fsize = Math . min ( fsize , nfsize ) ; } app . saveState ( ) ; app . rectangle ( offX , offX , wt , ht ) ; app . clip ( ) ; app . newPath ( ) ; if ( textColor == null ) app . resetGrayFill ( ) ; else app . setColorFill ( textColor ) ; app . beginText ( ) ; app . setFontAndSize ( ufont , fsize ) ; app . setTextMatrix ( ( box . getWidth ( ) - ufont . getWidthPoint ( text , fsize ) ) / 2 , ( box . getHeight ( ) - ufont . getAscentPoint ( text , fsize ) ) / 2 ) ; app . showText ( text ) ; app . endText ( ) ; app . restoreState ( ) ; return app ; }
Gets the field appearance .