refactor fontconfig code