riched20: Move y offset calculation to a helper function.