Refactor font building code.