Fix performance issues when rendering text