NP++ Standard control characters



  • I have made a font that defines all of the first 256 characters. When I use that font in np++, there are still some charactes that displays Black boxed SOH, STX, … . How can I prevent that. This font of mine works well in other applications.



  • Notepad++ uses a Scintilla component for the underlying editor object(s) of the application. Scintilla is in charge of handling control characters – which aren’t supposed to be rendered as a displayed character, per se, under normal ASCII or UNICODE standards; control characters are supposed to control how other things (like the terminal) behave.

    As you saw, Scintilla’s default handling for unknown control characters (not tabs, newlines, etc) is to render the two or three-character shorthand for that control character in a black box. There is a way to somewhat override Scintilla’s handling, by using the PythonScript: editor.setRepresentation( CHARACTER , STRING_TO_USE ) will change from using that default string to a string of your choice. For example, if I insert an STX character ( U+0002 ), and then run editor.setRepresentation( u'\u0002', "My Own String"), the STX character will render as My Own String in the black box instead of STX.

    So, assuming you have a glyph defined in your font at codepoint 2, I think the following might display your glyph, but inside the black box: editor.setRepresentation( u'\u0002', u'\0002') – this replaces the U+0002 character with the string consisting solely of the U+0002 character. In my font, that renders as an empty black box; but if you have something at that codepoint, I think it might display that glyph in the black box instead. I don’t have a font that defines control characters like that, so I cannot test.

    Unfortunately, I don’t know how you might tell the underlying Scintilla component to not render it in the black box.

    Hope this helps at least a little. Maybe there’s someone else that knows another way.



  • Well, you would have to start again, but I think by far the best thing to do is to switch to using UTF-8. This encodes the full set of UNICODE characters and is supported by NP++.

    I am assuming that when you say ‘made a font’ you haven’t actually created a font with your own glyphs, but simply want to write files using some UNICODE characters.

    David


Log in to reply