Truncate labels, which does not fit in box.

Close #1208.
Two lines are same for all labels so they can be computed once.