add a ratio to decide when to create a justified line

fix #512