nerd-fonts icon indicating copy to clipboard operation
nerd-fonts copied to clipboard

Patcher does not check for illegal characters in output filename

Open nobuyukinyuu opened this issue 4 years ago • 2 comments

🎯 Subject of the issue

As stated in title. Fonts which have fullnames containing characters illegal to the filesystem are not accounted for, and will cause the patcher to fail when producing final output. This could be worked around with an output file flag, or code to substitute illegal characters before final output.

🔧 Your Setup

  • Which font are you using ? int10h -- Px437 DOS/V re. JPN16 (Px437_DOS-V_re_JPN16.ttf)

  • Which terminal emulator are you using (e.g. iterm2, urxvt, gnome, konsole)? Windows Terminal 1.8

  • Are you using OS X, Linux or Windows? And which specific version or distribution?
    Windows 10. The issue most likely exists (with slight variants in allowed characters) for all systems.

nobuyukinyuu avatar Jun 03 '21 08:06 nobuyukinyuu

The font names should (imho) change to be the postscript names of that fonts (see #722). That would solve your issue en passant.

Unfortunately changing the font file name will probably upset people ;)

But you are right and I should create a proper PR and not only a discussion.

Finii avatar Feb 23 '22 08:02 Finii

OH MY!... read that incorrectly. Of course the PS name limit is enough also for file names

Ignore this comment.

~~Ah, this would be not enough...~~

    @staticmethod   
    def postscript_char_filter(name):
        """Filter out characters that are not allowed in Postscript names"""
        # The name string must be restricted to the printable ASCII subset, codes 33 to 126,
        # except for the 10 characters '[', ']', '(', ')', '{', '}', '<', '>', '/', '%'
        out = ""
        for c in name:
            if c in '[](){}<>/%' or ord(c) < 33 or ord(c) > 126:
                continue
            out += c
        return out

~~I will add this Issue to the discussion.~~

Edit: 'Remove' this comment

Finii avatar Feb 23 '22 08:02 Finii

This issue has been automatically locked since there has not been any recent activity (i.e. last half year) after it was closed. It helps our maintainers focus on the active issues. If you have found a problem that seems similar, please open a new issue, complete the issue template with all the details necessary to reproduce, and mention this issue as reference.

github-actions[bot] avatar Jun 26 '23 00:06 github-actions[bot]