Community
    • Login

    Tall tops/bottoms of Devanāgarī letters are clipped in monospace fonts

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    5 Posts 4 Posters 140 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.
    • RaviShankar RR
      RaviShankar R
      last edited by

      I use Notepad++ v8.8.5.

      I use monospaced font (where every character occupies the same horizontal space, unlike variable-width (proportional) fonts where character widths differ), like Consolas (sans-serif typeface) / Courier New (serif typeface) for both for English as well as for Devanāgarī text.

      However, some sanskrit letters like ति / ते / तॄ are being clipped on top or the bottom while being rendered in Consolas font. Seems like monospace fonts include only basic glyph support, and their line height is tuned for English letters — which don’t have tall tops/bottoms like ि or ॄ. I believe, that’s why I see clipping.

      I believe that if linespacing or padding on top and bottom of line are adjusted, it may fix the issue; or may be there is another fix, which I am not aware.

      I have tried (and these did not fix the issue) —
      a) Enabling & Disabling DirectWrite (default) – both actions followed by restart of Notepad++
      b) Increasing the font size by +1 or +2

      I haven’t tried Windows font fallback
      ** Set Notepad++ font to Consolas.
      ** Install Noto Sans Devanagari or Mangal.
      ** (Hopefully) Windows will silently use those for missing Devanāgarī glyphs.
      ** Problem is: fallback fonts may still look visually different from Consolas (not monospaced).

      Kindly advice / provide a solution, such that the Devanāgarī letters are not clipped, please.

      #sanskrit #padding #devanagari #clipped #monospace-font

      CoisesC mpheathM 2 Replies Last reply Reply Quote 1
      • CoisesC
        Coises @RaviShankar R
        last edited by Coises

        @RaviShankar-R said in Tall tops/bottoms of Devanāgarī letters are clipped in monospace fonts:

        I believe that if linespacing or padding on top and bottom of line are adjusted, it may fix the issue;

        It appears that you are correct. Try the following:

        • With mixed English and Devanāgarī text in the display, make sure Language is None (Normal Text).

        • Open Settings | Style Configurator… and be sure Global Styles is selected in the Language drop-down.

        • Make note of the Font size set for Default Style.

        • Select Indent guideline style. Use the Font size drop-down to select a size one or more steps larger than the size for Default Style. Watch the text to see when you have increased it enough.

        I haven’t tried Windows font fallback
        […]
        ** Problem is: fallback fonts may still look visually different from Consolas (not monospaced).

        You’re already using font fallback. If you look closely, you’ll see that the Devanāgarī characters are not the same width as the Latin characters, and Latin characters following different Devanāgarī characters in different lines don’t line up in columns.

        The only font I’ve found that is “monospaced” with Devanāgarī characters — in the sense that the width of Devanāgarī characters is an integer multiple of the width of Latin characters, so Latin characters “line up” even when they are preceded by different numbers of Devanāgarī characters — is UnifontEx. If you want to try it, download and install the UnifontExMono.ttf file. It’s not a very pretty font, though — more like an uglier version of Courier New than Consolas. You don’t need to increase the Indent guideline style font size with this font.

        RaviShankar RR 1 Reply Last reply Reply Quote 3
        • RaviShankar RR
          RaviShankar R @Coises
          last edited by

          @Coises – This solution worked like a charm :)

          Thank you very much !!

          Try the following:

          With mixed English and Devanāgarī text in the display, make sure Language is None (Normal Text).

          Open Settings | Style Configurator… and be sure Global Styles is selected in the Language drop-down.

          Make note of the Font size set for Default Style.

          Select Indent guideline style. Use the Font size drop-down to select a size one or more steps larger than the size for Default Style. Watch the text to see when you have increased it enough.

          1 Reply Last reply Reply Quote 1
          • mpheathM
            mpheath @RaviShankar R
            last edited by

            @RaviShankar-R said in Tall tops/bottoms of Devanāgarī letters are clipped in monospace fonts:

            Kindly advice / provide a solution, such that the Devanāgarī letters are not clipped, please.

            The line height can be altered by increasing the extra ascent or descent with using the LuaScript plugin.

            Add to startup.lua:

            -- Increase line height for Devanāgarī text.
            editor.ExtraAscent = 8
            editor.ExtraDescent = 6
            

            Tested with Courier New and Consolas size 10 with Directwrite enabled.

            Reference: editor.ExtraAscent

            PeterJonesP 1 Reply Last reply Reply Quote 2
            • PeterJonesP
              PeterJones @mpheath
              last edited by

              @mpheath said in Tall tops/bottoms of Devanāgarī letters are clipped in monospace fonts:

              The line height can be altered by increasing the extra ascent or descent with using the LuaScript plugin.

              Or using PythonScript plugin: add to startup.py:

              editor.setExtraAscent(8)
              editor.setExtraDescent(6)
              

              And make sure Plugins > Python Script > Configuration has Initialisation set to ATSTARTUP.

              Or ExtSettings plugin, using the Upper Line Spacing and Lower Line Spacing fields.

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