Community
    • Login

    NP++ Standard control characters

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    3 Posts 3 Posters 2.0k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Claude LamyC
      Claude Lamy
      last edited by

      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.

      1 Reply Last reply Reply Quote 0
      • PeterJonesP
        PeterJones
        last edited by

        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.

        1 Reply Last reply Reply Quote 1
        • David BaileyD
          David Bailey
          last edited by

          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

          1 Reply Last reply Reply Quote 0
          • First post
            Last post
          The Community of users of the Notepad++ text editor.
          Powered by NodeBB | Contributors