Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Emacs rendering of combining characters #87

Closed
sje30 opened this issue Dec 29, 2020 · 19 comments
Closed

Emacs rendering of combining characters #87

sje30 opened this issue Dec 29, 2020 · 19 comments

Comments

@sje30
Copy link

sje30 commented Dec 29, 2020

First off, thank you for the font, and no worries if you can't comment on this (having read your template text here in the issue.) I'm wondering though if you could shed any light on why I can't get characters like a followed by x0305 to render as a with the combining overline in Emacs? I'm thinking of using this for "the mean of a".

I asked on the Emacs help list, and was told "You need to use a font that has glyphs both for a (every font will fulfill that requirement) and the diacritics. Emacs can only compose characters if their glyphs come from the same font.

See my message:
https://lists.gnu.org/archive/html/help-gnu-emacs/2020-12/msg01058.html

and my screenshot comparing how the same file renders in Emacs (on the left) and xfce4-terminal (on the right). Note, this is GUI Emacs, not the version of Emacs that runs within a terminal.

https://damtp.cam.ac.uk/user/sje30/temp/accents.png

@cormullion
Copy link
Owner

cormullion commented Dec 30, 2020

“You need to find a better font!” - a commenter on that thread. 😀

It works fine on a better OS (MacOS). 😛 in other places...

More seriously, I don’t think it’s an issue with the font, since diacritics work OK for me. If you want to investigate, you could search the issues at FiraCode HQ https://github.com/tonsky/FiraCode/issues/ - there are similar issues with fonts and editors.

I’ll ask around for help...

@sje30
Copy link
Author

sje30 commented Dec 30, 2020

Thank you. Checking the firacode + emacs, I don't see anything relating to combining characters, but I do for ligatures. It looks like Emacs needs hacking to handle ligatures in firacode. https://github.com/jming422/fira-code-mode -- I will investigate.

(And just checking - when you say it works on MacOS, do you mean it works on Emacs GUI on MacOS? I'm guessing not.)

@cormullion
Copy link
Owner

I don't know about EmacsGui.

for i in 1:20
      print('a', Char(769 + i))
end

âãāa̅ăȧäảåa̋ǎa̍a̎ȁa̐ȃa̒a̓a̔a̕

Obviously OK in Emacs/Terminal.

Screenshot 2020-12-30 at 09 28 34

Most of the diacritic characters are defined in the font:

Screenshot 2020-12-30 at 09 34 20

I expect you'll have to hack Emacs even more to get it to do the right thing... :)

@sje30
Copy link
Author

sje30 commented Dec 30, 2020

Thanks for this. Will keep digging.

@knuesel
Copy link
Collaborator

knuesel commented Dec 30, 2020

I just tried with the latest JuliaMono (0.028). I compiled Emacs 27.1 with GTK and HarfBuzz 2.6.4 on Ubuntu 20.04 and I can't reproduce the problem. I don't have any .emacs config, Emacs is inheriting the JuliaMono font choice from the gnome-weaks settings.

@sje30
Copy link
Author

sje30 commented Dec 30, 2020

Thanks @knuesel -- good to hear there is some success!

It gets weirder for me (I'm using Emacs 27.1 from manjaro.)


;; case 1
(when (member "Monaco" (font-family-list))
   (set-face-attribute 'default nil :font "Monaco-13"))

;; case 2
(when (member "JuliaMono" (font-family-list))
   (set-face-attribute 'default nil :font "JuliaMono"))

when asking it to show "gamma bar" and "x bar" Monaco (case 1) gets both right, but in case 2 (JuliaMono) it gets gamma correct, but not x!

case 1 (Monaco):
case1

case 2 (JuliaMono):

case2

@sje30
Copy link
Author

sje30 commented Dec 30, 2020

weirder still... trying the JuliaMono font on Chromium (which I believe uses harfbuzz too for rendering) to view a file, both look fine:

case3

@cormullion
Copy link
Owner

Vim? 😁

@sje30
Copy link
Author

sje30 commented Dec 30, 2020

vim works in the terminal, right? If so, I expect that to work ok. Emacs in the terminal works ok for me too (as it is the terminal doing the composing not the Emacs GUI.)

@cormullion
Copy link
Owner

Oh, yes, true. I'm still using Atom... :)

@sje30
Copy link
Author

sje30 commented Dec 30, 2020

I've posted an issue too on harfbuzz in case anyone else is following this.

harfbuzz/harfbuzz#2790

@cormullion
Copy link
Owner

Thanks! I really appreciate your commitment to finding a solution!

@sje30
Copy link
Author

sje30 commented Dec 30, 2020

thank you for your efforts too!

@sje30
Copy link
Author

sje30 commented Jan 1, 2021

not exactly why my solution works, but installing the font to my home directory rather than using the arch package worked.

https://lists.gnu.org/archive/html/bug-gnu-emacs/2021-01/msg00001.html

yay!

@sje30 sje30 closed this as completed Jan 1, 2021
@cormullion
Copy link
Owner

Thanks - the Emacs discussion guys said that it was a problem just on your installation? I hate it when that happens... :)

@sje30
Copy link
Author

sje30 commented Jan 1, 2021

yes. but that's okay. I'm glad to be looking at nice fonts now... great work, thank you.

@ScottPJones
Copy link

Cormullion + Emacs = Nice!

@cormullion
Copy link
Owner

@ScottPJones I only used it for a minute - eventually I had to kill the Terminal because I didn't know how to quit Emacs (apparently Ctrl-C isn't good enough... :)).

@ScottPJones
Copy link

@cormullion Yeah, it's C-X C-C :-) (otherwise, you'd be exiting by mistake all the time!)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants