Fix bug in getComputedTextLength with legend text