Community
    • Login

    Can you use separate fonts for separate documents?

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    5 Posts 2 Posters 336 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.
    • Dušan MajakovićD
      Dušan Majaković
      last edited by

      Hi, NP++ team!

      Right now I have two documents that I’m working on:

      One uses the default “Courier New” font,

      and the other uses “Nato Sans Math” font for (as you can guess) mathematical notes which contain lots of mathematical symbols and formulas.

      Since I usually have multiple documents open in various tabs in the Notepad++ window, I’m wondering, is it possible to set a default font style for each document that I’m working on, so that I don’t have to switch back and forth between each font each time I’m done with one document, and move over to another?

      PeterJonesP 1 Reply Last reply Reply Quote 0
      • PeterJonesP
        PeterJones @Dušan Majaković
        last edited by

        @Dušan-Majaković ,

        Not directly. Text styling is defined by the active lexer (programming language syntax highlighting) using values from Style Configurator or UDL definition, not on a per-file basis: it’s effectively based on file type, not specific file.

        However, if your “other” file has a unique extension, or if you were otherwise willing to override the Language lexer for that file, then you could define a NatoSansMath User Defined Language (UDL): if it has a specific extension (like .math), then you can set the UDL’s extension to math , and from then on, all *.math files will open with that UDL. If you don’t have a unique extension, then you would just manually select Language > NatoSansMath for that file… and until you close the file, Notepad++ will remember the UDL applied.

        Inside that UDL definition, you could use the Default style to set the font for that language type.
        37d6b80c-df43-477e-a57f-b9530ac6e3b6-image.png
        You could also style numbers and operators differently from other text (for example, a different color) to make the mathematical operators stick out. (Please note: User Defined Language doesn’t have a concept of unicode, unfortunately, so you cannot use it to change the color of non-ASCII operators or symbols, sorry. If that’s important, ask about the workaround)

        • Online Usermanual overview of UDL: https://npp-user-manual.org/docs/user-defined-language-system/
        • Details of each UDL field: https://ivan-radic.github.io/udl-documentation/
        Dušan MajakovićD 1 Reply Last reply Reply Quote 3
        • Dušan MajakovićD
          Dušan Majaković @PeterJones
          last edited by

          @PeterJones

          Thank you for the reply, Peter!

          Renaming the math document to a .math extension is actually a brilliant idea, as I can still see human-readable text even when the extension is changed.

          Now, what I don’t know how to do is how to define NatoSansMath UDL just for this particular file extension.

          When I go to Settings > Style Configurator, I can’t see anything about defining UDL for a specific file extension.

          How exactly does one do this?

          PeterJonesP 1 Reply Last reply Reply Quote 0
          • PeterJonesP
            PeterJones @Dušan Majaković
            last edited by

            @Dušan-Majaković ,

            by using the Language > User Define Language > Define Your Language interface, as documented in the UDL section of the User Manual that I already linked you to.

            Dušan MajakovićD 1 Reply Last reply Reply Quote 2
            • Dušan MajakovićD
              Dušan Majaković @PeterJones
              last edited by

              @PeterJones

              Done! I finally got it to work!

              Thank you so much for the help!

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