Alhadis / Menloco

Replaces the Monaco typeface's box-drawing characters with those from Menlo.
MIT License
25 stars 2 forks source link

Use triangles from Menlo #3

Closed silverwind closed 6 years ago

silverwind commented 6 years ago

Monaco's unicode triangles are of non-uniform width which breaks any drawing that uses them. Use Menlo's triangles instead which adhere the fixed width.

Before

screen shot 2018-02-25 at 11 36 22

After

screen shot 2018-02-25 at 11 35 56

Sample text

 ┌─────────┐ ◀───┐    ┌─────────┐
 │  Lorem  │     │    │  Lorem  │
 │  ipsum  │     └────│  ipsum  │
 │dolor sit│─────────▶│dolor sit│
 │  amet,  │ ◀───┐    │  amet,  │
 │consectet│ │   │    │consectet│
 └─────────┘ │   │    └─────────┘
  │   ▲      │   │     │   │   │ 
  │   │  ┌───┘   │     │   │   │ 
  └─┐ │  │       │     └─┐ │ ┌─┘ 
    │ │  │       │       │ │ │   
    ▼ │  ▼       └────   ▼ ▼ ▼   
 ┌─────────┐ ◀──┐     ┌─────────┐
 │  Lorem  │    │     │  Lorem  │
 │  ipsum  │    └──── │  ipsum  │
 │dolor sit│────────▶ │dolor sit│
 │  amet,  │    ┌──── │  amet,  │
 │consectet│    │     │consectet│
 └─────────┘ ◀──┘     └─────────┘
silverwind commented 6 years ago

Looks like this introduces an issue when these triangles are rendered in iTerm:

Monaco

screen shot 2018-02-25 at 12 08 39

Menloco

screen shot 2018-02-25 at 12 07 57

Not sure what to do about this. It looks okay in all GUI apps, but renders differently in the terminal for some reason.

Alhadis commented 6 years ago

Not sure what to do about this. It looks okay in all GUI apps, but renders differently in the terminal for some reason.

You could add an option to include triangles:

λ make with=triangles

And then in the Makefile:

 merge: $(OBJDIR)/$(FROM).ttf $(OBJDIR)/$(INTO).ttf
    @utils/ff-patch.py \
        --from=$(OBJDIR)/$(FROM).ttf \
        --into=$(OBJDIR)/$(INTO).ttf \
+       --with=$(with) \

And then add whatever conditional logic needs to go into the Python script to include the optional glyphs. :wink: If we need more options in future, then we can simply parse it as a comma-separated list:

λ make with=triangles,emoji,other-spiffy-crap

:cry: My MacBook died late last year, so I'm afraid I can't really review this in much depth (or even see the output for myself). Kind of ironic how I refrained from uploading the source fonts because they were copyrighted by Apple, then the MacBook screen "mysteriously" breaks shortly after the 2-year warranty expired. :laughing:

So I'm willing to merge this on good faith. :wink:

silverwind commented 6 years ago

You could add an option to include triangles

I think I'd rather like to figure out why they render differently. If I can fix it, I'd consider this change a pure improvement, and I don't think we'd need an option for it 😉

silverwind commented 6 years ago

I think I have to give up on this. The last commit (which is mostly informational at this point) fixes the issue in terminal rendering by vertical centering the points on the glyph's y-axis but this fix breaks the centering in non-terminal applications, and I have not the slightest idea why that's happening.

I think I'll have to use a different font in GUI applications. For terminals, Menloco is still pretty nice, thought 👍

Alhadis commented 6 years ago

but this fix breaks the centering in non-terminal applications, and I have not the slightest idea why that's happening

Loose guesses: a baseline or X-height wasn't lifted or moved properly? There're autohinting instructions behind carried over that screw the rasterisation of other parallel lines?

I commend you for trying, though. ;)

Another entry on my list of "Crazy Node Projects to do before I die" ~ have a full-blown typography editing program setup purely in JS, HTML and CSS. It'll be free, it'll let typophilliacs like myself get theri fingers as dirty as they like, and - much more importantly - it'll provide a vehicle for generating the icon fonts used by the Atom file-icons package... which is still currently reliant on IcoMoon... ugh.

silverwind commented 6 years ago

It has more to do that the box-drawing characters itself are not centered on the ascent:

screen shot 2018-02-25 at 16 17 27

The only fix I can think of would be offsetting the glpyh by some arbitrary value, or centering the all box-drawing characters.

silverwind commented 6 years ago

Okay, decided to finish this with a static offset on the left/right triangles. Looking good everywhere now for me:

screen shot 2018-02-25 at 16 38 57 screen shot 2018-02-25 at 16 38 34 screen shot 2018-02-25 at 16 38 19
Alhadis commented 6 years ago

I'm honestly wondering if it would be easier to just modify the lengths of Monaco's box-drawing characters so they're as long as Menlo's. :laughing:

Looks good! :D Is there anything else you think needs brushing up on? Because it LGTM. :+1:

silverwind commented 6 years ago

No, should be ready to merge. Eventually, I'd like to get rid of the semicolons on Python, but that's another PR :)

Alhadis commented 6 years ago

Semicolons rule. Check this out: :grinning:

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;,
                                                                                              ,
    ;;;;;;    ;;;;;;   ;;;;;   ;;;;;;  ;;  ;;    ;;;;;; ;;;;;;;    ;;;;;;  ;;  ;;  ;;;;;;     ,
    ;;   ;;;  ;;      ;;   ;;    ;;    ;;  ;;      ;;   ;;   ;;      ;;    ;;  ;;  ;;         ,
    ;;   ;;;  ;;;;;;  ;;;;;;;    ;;    ;;;;;;      ;;   ;;   ;;      ;;    ;;;;;;  ;;;;;;     ,
    ;;   ;;;  ;;      ;;   ;;    ;;    ;;  ;;      ;;   ;;   ;;      ;;    ;;  ;;  ;;         ,
    ;;;;;;    ;;;;;;  ;;   ;;    ;;    ;;  ;;      ;;   ;;;;;;;      ;;    ;;  ;;  ;;;;;;     ,
                                                                                              ,
    "" ;;;;;;;;; ;;;;;;;;;  ;;;;;;   ;;;;   ;;   ;;;;;;     ;;;;;;   ;;;;;;    ;;;;;;  ""     ,
       ;;           ;;     ;;    ;;  ;; ;;  ;;   ;;   ;;;  ;;    ;;  ;;    ;;  ;;   ;;;       ,
       ;;;;;;;;;    ;;     ;;;;;;;;  ;;  ;; ;;   ;;   ;;;  ;;;;;;;;  ;;;;;;    ;;   ;;;       ,
              ;;    ;;     ;;    ;;  ;;   ;;;;   ;;   ;;;  ;;    ;;  ;;   ;;   ;;   ;;;       ,
       ;;;;;;;;;    ;;     ;;    ;;  ;;    ;;;   ;;;;;;    ;;    ;;  ;;    ;;  ;;;;;;         ,
                                                                                              ,
                   ;;;;;;;;;  ;;;;;;;;;  ;;     ;;  ;;        ;;;;;;;;;                       ,
                   ;;            ;;       ;;  ;;    ;;        ;;                              ,
                   ;;;;;;;;;     ;;         ;;      ;;        ;;;;;;;;;                       ,
                          ;;     ;;         ;;      ;;        ;;                              ,
                   ;;;;;;;;;     ;;         ;;      ;;;;;;;   ;;;;;;;;;                       ,
                                                                                              ,
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Alhadis commented 6 years ago

Thanks for that! :D Especially since I'm unable to do much macOS-related stuff anymore. The contribution is warmly welcomed.

silverwind commented 6 years ago

Thanks.

Actually, I enforce semicolons in JS, but seeing red semicolons in the Github interface is a bit disturbing :)