Cleanup: Refactor some code into its own function in fpdf_text_int.cpp.