Handle cases where the fontName contains non-alphanumeric characters (issue 4909)

Fixes #4909.