Refactor new code into `determine_text_centerlines`