created text rendering function