dynamic line breaking algorithm with log information