average text width calculation