@ SuppressWarnings ( "StatementWithEmptyBody" ) private static int calculateOverlay ( FigletFont figletFont , char [ ] [ ] char1 , char [ ] [ ] char2 ) { if ( figletFont . smushingRulesToApply . getHorizontalLayout ( ) == SmushingRule . Layout . FULL_WIDTH ) { return 0 ; } int maxPotentialOverlay = figletFont . maxLine ; for ( int l = 0 ; l < figletFont . height ; l ++ ) { if ( char1 [ l ] == null ) { char1 [ l ] = new char [ 0 ] ; } char [ ] c1 = char1 [ l ] ; char [ ] c2 = char2 [ l ] ; int c1Length = c1 . length - 1 ; int c2Length = c2 . length - 1 ; int c1EmptyCount ; int c2EmptyCount ; for ( c1EmptyCount = 0 ; c1EmptyCount < c1Length && c1 [ c1Length - c1EmptyCount ] == ' ' ; c1EmptyCount ++ ) { } for ( c2EmptyCount = 0 ; c2EmptyCount < c2Length && c2 [ c2EmptyCount ] == ' ' ; c2EmptyCount ++ ) { } int overlay = c1EmptyCount + c2EmptyCount ; if ( c1EmptyCount <= c1Length && c2EmptyCount <= c2Length ) { if ( figletFont . smushingRulesToApply . getHorizontalLayout ( ) == SmushingRule . Layout . SMUSHING && SmushingRule . HORIZONTAL_SMUSHING . smushes ( c1 [ c1Length - c1EmptyCount ] , c2 [ c2EmptyCount ] , figletFont . hardblank ) || figletFont . smushingRulesToApply . smushesHorizontal ( c1 [ c1Length - c1EmptyCount ] , c2 [ c2EmptyCount ] , figletFont . hardblank ) ) { overlay ++ ; } } if ( overlay < maxPotentialOverlay ) { maxPotentialOverlay = overlay ; } } return maxPotentialOverlay ; }
Workouts the amount of characters that can be smushed across all lines .