jimeh / build-emacs-for-macos

Somewhat hacky script to automate building of Emac.app on macOS.
484 stars 50 forks source link

How to compile with Harfbuzz and Cairo? #56

Closed mateusfccp closed 7 months ago

mateusfccp commented 3 years ago

I am using build-emacs-for-macos for a while and it's really nice.

However, I didn't manage to compile with Cairo and Harfbuzz. They should be default, but even if I explicitly pass --with-harfbuzz and --with-cairo to configFlags it won't be compiled with them.

How may I compile with Harfbuzz and Cairo?

jimeh commented 3 years ago

It looks like harfbuzz and cairo support for macOS is rather recent. Last I looked into it about a year ago it was not possible.

However emacs-plus supports it as of 6 weeks ago, so I'll try and get support added to build-emacs-for-macos here this weekend :)

mateusfccp commented 3 years ago

Yes, at first I thought that it was not supported, but then I saw this issue from emacs-plus. I don't know, however, what has to be done.

I'll try and get support added to build-emacs-for-macos here this weekend :)

Thanks!

jimeh commented 3 years ago

Actually, it seems harfbuzz and cairo support has been removed from emacs-plus as it turns out they yield no advantage over macOS's own CoreText renderer, which is why upstream emacs itself does not support it on macOS. More details here: https://github.com/d12frosted/homebrew-emacs-plus/pull/371#issuecomment-881976323

As such, I don't think there's much point in porting over the now removed patch from emacs-plus. @mateusfccp please let me know if you would still like the ability to try harfbuzz and cairo on macOS out of curiosity, cause then I'm happy to spend the 5-10 minutes required to get it working :)

mateusfccp commented 3 years ago

@jimeh My main use-case for this is to enable font ligatures, which, AFAIK, is not supported through CoreText, but I may be wrong...

mateusfccp commented 3 years ago

Well, reading the comment you linked, the author seems to be able to enable ligatures without Harfbuzz, although I have no idea how.

jimeh commented 3 years ago

Yeah, indeed. I've never tried using ligatures myself. I'll give it a go this weekend and see what I can find :)

schellj commented 3 years ago

@mateusfccp @jimeh FYI, I just tested using ligatures via ligature.el with the latest Emacs master and Emacs 28 builds from emacs-builds and it works fine without any additional steps, though the rendering isn't quite perfect, at least with the latest Fira Code font.

ligature-mode disabled: image

ligature-mode enabled: image

jimeh commented 3 years ago

@schellj Neat, I never got around to testing it myself. But I'm gonna try and get a number of outstanding things resolved over the next few weeks, so I'm gonna try ligatures myself. And I'll also try and get a build with harfbuzz/cairo and see how it compares.

mateusfccp commented 3 years ago

@schellj Thanks! I am almost sure I did try ligatures.el before but it didn't work. I am going to give it another try!

schellj commented 3 years ago

FWIW, it looks like the non-perfect rendering of the ligatures in my previous comment may just be due to that particular font (Fira Code). JetBrains Mono does a better job (e.g., you can't see where characters have been merged in spaceship (<=>), fat comma (=>) and arrow (->)): image