Update render_text_rect function