cpitclaudel / monospacifier

Convert variable-pitch fonts to monospace (useful for unicode and indentation-friendly programming)
GNU General Public License v3.0
379 stars 31 forks source link

Overlapping icons with Symbola monospacified for Inconsolata #1

Closed zakkak closed 8 years ago

zakkak commented 8 years ago

Hi @cpitclaudel,

I tried using the Symbola monospacified for Inconsolata font and I end up with overlapping icons (and slight miss-alignment)

See attached picture bellow: screenshot from 2015-12-17 01-56-35

cpitclaudel commented 8 years ago

Hi @zakkak,

Some overlapping is expected, misalignment is not :) The overlapping is easy to fix by adding padding to the symbols (notice the spaces in my config below):

(defconst mu4e-symbols-override
  '((mu4e-headers-draft-mark     . ("D" . "📝 ")) ;; ✒ ✏
    (mu4e-headers-flagged-mark   . ("F" . "🏴 "))
    (mu4e-headers-new-mark       . ("N" . "★ "))
    (mu4e-headers-passed-mark    . ("P" . "→ ")) ;; ↪
    (mu4e-headers-replied-mark   . ("R" . "← "))
    (mu4e-headers-seen-mark      . ("S" . "")) ;; ✓ 🗸 ✔
    (mu4e-headers-trashed-mark   . ("T" . "✗ ")) ;; 🗑
    (mu4e-headers-attach-mark    . ("a" . "📎 "))
    (mu4e-headers-encrypted-mark . ("x" . "🔐 "))
    (mu4e-headers-signed-mark    . ("s" . "🔏 "))
    (mu4e-headers-unread-mark    . ("u" . "✉ "))
    (mu4e-headers-has-child-prefix    . ("+" . "◼"))
    (mu4e-headers-empty-parent-prefix . ("-" . "◽"))
    (mu4e-headers-first-child-prefix  . ("\\" . "↳"))
    (mu4e-headers-duplicate-prefix    . ("=" . "⚌"))
    (mu4e-headers-default-prefix      . ("|" . "┃"))))

I'll elaborate on this a bit later tonight, and I'll have a look at the misalignment thing :)

cpitclaudel commented 8 years ago

Here's a bit more info: the overlapping is expected, because Symbola's Glyphs are not all of the same size. Thus monospacifier.py adds some padding around the thin ones, and slightly shrinks the thick ones. It only does the latter up to a point, though; otherwise you wouldn't be able to distinguish ⟶ and →. For this reason, large glyphs bleed a bit on their neighbours — which is fine as long as you include space around them.

cpitclaudel commented 8 years ago

I just tried this with Inconsolata as the monospace font, and I can't reproduce the issue though. Can you paste the output of C-u C-x = with the point on the anchor symbol, and with the point on a regular letter?

Thanks!

zakkak commented 8 years ago

I am using a patched version for powerline of Inconsolata LGC, but I have also tried Droid Sans Mono and they also appear misaligned.

With point at anchor:

             position: 246 of 38802 (1%), column: 16
            character: ⚓ (displayed as ⚓) (codepoint 9875, #o23223, #x2693)
    preferred charset: unicode (Unicode (ISO10646))
code point in charset: 0x2693
               script: symbol
               syntax: w    which means: word
             category: .:Base
             to input: type "C-x 8 RET HEX-CODEPOINT" or "C-x 8 RET NAME"
          buffer code: #xE2 #x9A #x93
            file code: #xE2 #x9A #x93 (encoded by coding system utf-8-unix)
              display: by this font (glyph code)
    xft:-unknown-Symbola monospacified for Inconsolata-normal-normal-normal-*-16-*-*-*-m-0-iso10646-1 (#x9B1)

Character code properties: customize what to show
  name: ANCHOR
  general-category: So (Symbol, Other)
  decomposition: (9875) ('⚓')

There is an overlay here:
 From 223 to 291
  face                 mu4e-header-highlight-face
  priority             -50
  window               nil

There are text properties here:
  docid                46005
  face                 mu4e-header-face
  help-echo            "(seen signed attach list)"
  msg                  [Show]

With point at regular letter:

             position: 268 of 38802 (1%), column: 38
            character: t (displayed as t) (codepoint 116, #o164, #x74)
    preferred charset: ascii (ASCII (ISO646 IRV))
code point in charset: 0x74
               script: latin
               syntax: w    which means: word
             category: .:Base, L:Left-to-right (strong), a:ASCII, l:Latin, r:Roman
             to input: type "C-x 8 RET HEX-CODEPOINT" or "C-x 8 RET NAME"
          buffer code: #x74
            file code: #x74 (encoded by coding system utf-8-unix)
              display: by this font (glyph code)
    xft:-unknown-Inconsolata LGC for Powerline-normal-normal-normal-*-16-*-*-*-m-0-iso10646-1 (#x57)

Character code properties: customize what to show
  name: LATIN SMALL LETTER T
  general-category: Ll (Letter, Lowercase)
  decomposition: (116) ('t')

There is an overlay here:
 From 223 to 291
  face                 mu4e-header-highlight-face
  priority             -50
  window               nil

There are text properties here:
  docid                46005
  face                 mu4e-header-face
  msg                  [Show]
cpitclaudel commented 8 years ago

The misalignment with Droid Sans Mono would be expected as well; Droid Sans Mono doesn't have the same width as Inconsolata :)

I've pushed a new copy of the fonts; could you try it? Here's a screenshot with

    (set-fontset-font t 'unicode (font-spec :name "Inconsolata LGC for Powerline") nil)
    (set-fontset-font t 'unicode (font-spec :name "Symbola monospacified for Inconsolata LGC for Powerline") nil 'append)

screenshot from 2015-12-17 08 41 14

zakkak commented 8 years ago

@cpitclaudel it works fine, thanks a lot. It also reduced the overlapping, when not using the extra space after the symbols. screenshot from 2015-12-17 16-06-34

cpitclaudel commented 8 years ago

Brilliant! Glad to hear it :) I'd love to find a better fix for the overlapping issue than the current one, but it's a bit tricky; scaling the glyphs doesn't work well, for example, as it's hard to find which point to stretch the glyphs around.

zakkak commented 8 years ago

Yes, it makes sense. Maybe having a monospace font with the complete set of the icons embed would help, since the icons would already be monospaced and scaling them would be enough to make them match the user's favourite monospace font.