refactored text canvas centering