Fix post table glyph name dedup logic for edge case

This is a followup fix to 85be2e0a9773acec3c6d14c345b1fd94ab3aa5c3
Before this change, if some glyph names had a "#-number" suffix in
the post table, we could generate duplicate glyph names.  Fix that,
even though "#" is NOT a valid character in PS glyph names.
Change cmap-based duplicate-name resolution from n^2 to linear time

Similar to 85be2e0a9773acec3c6d14c345b1fd94ab3aa5c3, though much
harder to hit.
Apply fixes from 'hhea' to 'vhea'

Maybe they should be merged...