Hack icon indicating copy to clipboard operation
Hack copied to clipboard

[Linux] Increased font spacing in Emacs

Open mjgiarlo opened this issue 11 years ago • 27 comments

Is anyone successfully using Hack in Emacs? I'm using it in Prelude (Emacs 24) and I see odd spacing when I set my font to Hack-Regular (have tried different sizes, from 9 to 12, with the same behavior). Interestingly, I don't see the same with either Hack-Bold or Hack-RegularOblique. See screenshots below.

First, with the oblique font (looks purty, if slanty):

screenshot from 2015-08-30 17 36 01

Now, with the regular font (wat):

screenshot from 2015-08-30 17 35 36

Any ideas? I downloaded the Hack-v2_010-ttf.zip as the README suggests for Linux installations, and tossed the .ttf files in my ~/.fonts folder. I'm using the same font w/ the same face just fine in Byobu/Tmux.

mjgiarlo avatar Aug 31 '15 00:08 mjgiarlo

I have the same problem with TTF: GNU Emacs 24.3.1 (x86_64-pc-linux-gnu, GTK+ Version 3.10.7), Ubuntu 14.04.3 LTS, Gnome-Shell. Oblique doesn't have this problem.

abramhindle avatar Aug 31 '15 02:08 abramhindle

Stumped on this one. First report I have seen with a spacing issue like this. It looks like it is increasing the em box size for every glyph so that the glyph size stays the same but the sidebearings get really wide. Let me look into Emacs rendering/spacing. I'm not familiar with it.

Mind giving the otf files a try to see if the same issue occurs?

chrissimpkins avatar Aug 31 '15 03:08 chrissimpkins

I think I have successfully installed the .OTF files, but it seems to have the same response. I wish I had a virtualized ubuntu handy to be completely sure.

abramhindle avatar Aug 31 '15 05:08 abramhindle

I have the very same spacing problem with Hack 2.010, GNU Emacs 24.5.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.16.2) on Arch Linux with the TTF. The OTF, however, looks just fine.

mbunkus avatar Aug 31 '15 07:08 mbunkus

Yes, I can confirm this. Spacing in emacs is totally off (GNU Emacs 24.4.1). Though for me it only happens when using the ttf version. otf seems to work.

Paethon avatar Aug 31 '15 14:08 Paethon

@chrissimpkins :clap: The OTF font works A-OK for me too. That suggests two courses of action to me:

  1. Change the README to recommend using OTF fonts (#worksforme)
  2. "Fix" the TTF fonts to render as expected in Emacs and Emacs-like environments.

Pls advise on whether I should close this issue or not. (I'm satisfied now, FWIW. Thanks, all!)

mjgiarlo avatar Aug 31 '15 15:08 mjgiarlo

OTF one still have weird vertical spacing issue, compare (dejavu, in plain terminal) zaznaczenie_2015-08-31_002

to (hack otf, but it is same for ttf) zaznaczenie_2015-08-31_001

XANi avatar Aug 31 '15 15:08 XANi

I confirm, OTF files seem to work. I ran:

sudo fc-cache -f -v

Giving me a list of font directories to scour. I found both ttf and otf laying around my computer. I removed all of them:

rm ~/.local/share/fonts/Hack-*

and reran the command. I then used the ubuntu font-viewer to install all 4 otf fonts. Upon starting emacs the font looked great.

@mjgiarlo is right. OTF work well for emacs/Ubuntu/linux.

@XANi I suggest ensuring that you really only installed 1 of them. Try running fc-cache.

abramhindle avatar Aug 31 '15 15:08 abramhindle

Same issue but otf works fine.

I am coming from a DejaVu Sans Mono and I would switch if it weren't for the _ spacing, as a C developer I really dislike it.

eneq avatar Aug 31 '15 16:08 eneq

:+1: for the OTF fix. I actually came here because I couldn't figure out why Emacs was behaving so weird after seeing this font in it.

ghost avatar Aug 31 '15 16:08 ghost

Are you noticing any rendering issues on Linux with the otf files? The difference in the PostScript hinting and TrueType instruction sets are bound to raise different rendering issues on different platforms. In general, the TT instructions render better on the screen. Let's leave this issue open and I will probe in more detail so that I can determine what the problem was with the ttf files.

chrissimpkins avatar Aug 31 '15 19:08 chrissimpkins

and thanks for sharing the fix!

chrissimpkins avatar Aug 31 '15 19:08 chrissimpkins

I'm perfectly happy with the OTF files, so far.

On Mon, Aug 31, 2015 at 12:05 PM Chris Simpkins [email protected] wrote:

and thanks for sharing the fix!

— Reply to this email directly or view it on GitHub https://github.com/chrissimpkins/Hack/issues/38#issuecomment-136469316.

mjgiarlo avatar Aug 31 '15 19:08 mjgiarlo

@chrissimpkins Not that I can tell, anyway. I am running Arch Linux with the Infinality patches to fontconf, etc.

Here's a screenshot of a test page (OTF): screenshot_20150831_151902

Not really sure what I'd be looking for, to be honest.

ghost avatar Aug 31 '15 19:08 ghost

I am not a font expert but I noticed something interesting. When dumped with fc-query there is no spacing value in the output for Hack-Regular.ttf like in other monospace fonts: fc-query Hack-Regular.ttf | grep spacing

VeraMono has spacing: fc-query VeraMono.ttf | grep spacing spacing: 100(i)(s)

But regular Vera does not fc-query Vera.ttf | grep spacing

The Hack-Bold.ttf file has spacing and works fine in Emacs fc-query Hack-Bold.ttf | grep spacing spacing: 100(i)(s)

schauveau avatar Aug 31 '15 20:08 schauveau

For the OTF fix, there is an annoying issue: The 'u' characters is significantly higher than other characters for about half of the font sizes. Other characters are fine.

That does not happen with all fontconfig settings. I noticed the problem with no autohinting and with full hinting.

Setting the hinting to medium solves the problem (but makes the font too blurry for my taste)

I noticed the problem in Emacs, xterm, lIbreoffice and a few other gtk2 apps

schauveau avatar Aug 31 '15 20:08 schauveau

I do have some issues with Hack (otf) in Emacs, particularly in C-mode and font-lock. There are some blurring issues that's not evident when using DejaVu Sans Mono or TTF in Windows.

I uploaded a few snapshots to give some visuals to what I see...

hack-win dejavu hack

eneq avatar Aug 31 '15 20:08 eneq

:+1: seeing same thing with TTF font in Debian unstable Emacs 24.5 fixed by OTF

fommil avatar Sep 01 '15 22:09 fommil

Have a look to https://github.com/chrissimpkins/Hack/issues/56 The TTF for build v2.011 mentioned in one of the later comments seems to solve the spacing problem

schauveau avatar Sep 02 '15 19:09 schauveau

I'm not seeing any issues with the v2.010 OTF fonts, FWIW. Thanks though @schauveau

mjgiarlo avatar Sep 02 '15 19:09 mjgiarlo