refactor font metrics handling.