Adjust the heuristics to recognize more cases of unknown glyphs for |toUnicode| (issue 5070)

Fixes #5070.
Done; I've also factored out the `glyphName === ''` case to avoid all of the, in this case, unnecessary heuristics.