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

Font looks different + really bad kerning #16978

Closed
bjornfor opened this issue Jul 15, 2016 · 17 comments · Fixed by #17042
Closed

Font looks different + really bad kerning #16978

bjornfor opened this issue Jul 15, 2016 · 17 comments · Fixed by #17042
Labels
0.kind: bug Something is broken 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS

Comments

@bjornfor
Copy link
Contributor

Issue description

Somewhere between b5a95b1 and 6af0f57 there is a commit that changes the default fonts on NixOS. Most text is just different (I'd say, a bit less readable). But some text in the terminal (gnome-terminal) is completely borked (in regards to positioning):

selection_002

Look at how the 's' is drawn on top of the 'M'. And generally the positioning of glyphs is... not right!

Steps to reproduce

Compare how fonts look in a few apps on nixpkgs b5a95b1 vs 6af0f57.

Technical details

  • System: x86_64-linux NixOS at master branch (6af0f57). No fonts.* settings in my configuration.nix file (never had that). GNOME3 desktop and gnome-terminal.
@abbradar
Copy link
Member

My guess is 1e53d4a. cc @ericsagnes. I'll try to switch to master and debug what happens.

@abbradar abbradar added 0.kind: bug Something is broken 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS labels Jul 15, 2016
@ericsagnes
Copy link
Contributor

Wild guess, is there a /etc/fonts. and a /etc/fonts.tmp folder?

Could you post the result of FC_DEBUG=1024 fc-match sans -s?

@bjornfor
Copy link
Contributor Author

bfo@whitetip ~
$ ls -l /etc/fonts*
lrwxrwxrwx 1 root root   17 Jul 15 10:51 /etc/fonts.tmp -> /etc/static/fonts

/etc/fonts:
total 8
drwxr-xr-x 3 root root 4096 Jul 15 10:47 2.11
drwxr-xr-x 2 root root 4096 Jul 15 10:47 conf.d
lrwxrwxrwx 1 root root   28 Jul 15 10:47 fonts.conf -> /etc/static/fonts/fonts.conf
bfo@whitetip ~
$ FC_DEBUG=1024 fc-match sans -s
FC_DEBUG=1024
    Loading config file /etc/fonts/2.11/fonts.conf
    Scanning config dir /etc/fonts/2.11/conf.d
    Loading config file /etc/fonts/2.11/conf.d/00-nixos.conf
    Loading config file /etc/fonts/2.11/conf.d/10-nixos-rendering.conf
    Loading config file /etc/fonts/2.11/conf.d/52-fontconfig-ultimate.conf
    Loading config file /etc/fonts/2.11/conf.d/99-user.conf
FreeMono.ttf: "FreeMono" "нормален"
FreeSans.ttf: "FreeSans" "нормален"
FreeSerif.ttf: "FreeSerif" "нормален"
DejaVuSans.ttf: "DejaVu Sans" "Book"
DejaVuSansMono.ttf: "DejaVu Sans Mono" "Book"
DejaVuSerif.ttf: "DejaVu Serif" "Book"
LiberationMono-Regular.ttf: "Liberation Mono" "Regular"
LiberationSerif-Regular.ttf: "Liberation Serif" "Regular"
luximr.ttf: "Luxi Mono" "Regular"
unifont.ttf: "Unifont" "Medium"
Roboto-Light.ttf: "Roboto" "Light"
DejaVuSerif-Italic.ttf: "DejaVu Serif" "Italic"
LiberationSerif-Italic.ttf: "Liberation Serif" "Italic"
DejaVuSans-BoldOblique.ttf: "DejaVu Sans" "Bold Oblique"
6x13.pcf.gz: "Fixed" "SemiCondensed"
9x15.pcf.gz: "Fixed" "Regular"

@bjornfor
Copy link
Contributor Author

Hm, I upgraded another machine to the same commit. Fonts look generally a bit different than they used to (for instance, in chromium + gmail). (I think the glyphs are just thinner and there is a lot of "air" around each letter.) But the horribly broken stuff in gnome-terminal doesn't happen on this machine. What's going on?

@ericsagnes
Copy link
Contributor

Can you try to remove /etc/fonts and /etc/fonts.tmp and do a nixos-rebuild to see if that improve the situation?

@bjornfor
Copy link
Contributor Author

Yes it does! Now all text look like it used to. Thanks!

sudo rm -rf /etc/fonts*
sudo nixos-rebuild [...]
reboot

After this, /etc/fonts.tmp is no more, only /etc/fonts:

$ ls -l /etc/fonts*
lrwxrwxrwx 1 root root 17 juli  15 12:19 /etc/fonts -> /etc/static/fonts

@bjornfor
Copy link
Contributor Author

Is this something we can fix in the NixOS module that sets up /etc/fonts, so that users upgrading from 16.03 to 16.09 won't hit this?

@abbradar
Copy link
Member

A heuristic idea for this -- a function isStatic :: Path -> Bool:

  • if path /etc/foo is a file, return True iff it's a symlink to /etc/static/foo.
  • if path is a directory, return True iff for all items in it isStatic is True.

On any conflicts, if old path is static, it's safe to replace and/or delete stale. Otherwise make a backup and notify the user via a journal entry and console output.

What are the possible caveats? This would certainly be nice to implement. I can look into this if it seems a good idea, but I suspect corresponding code is in Perl, which I'm illiterate with.

On July 15, 2016 1:25:53 PM GMT+03:00, "Bjørn Forsman" [email protected] wrote:

Is this something we can fix in the NixOS module that sets up
/etc/fonts, so that users upgrading from 16.03 to 16.09 won't hit this?


You are receiving this because you commented.
Reply to this email directly or view it on GitHub:
#16978 (comment)

Nikolay.

@ericsagnes
Copy link
Contributor

but I suspect corresponding code is in Perl ...

@abbradar Yes, the cause seems to be in the link function of setup-etc.pl.

@abbradar
Copy link
Member

Truth be told, I like better an idea of making /etc fully static, with several files (like /etc/passwd when mutableUsers = true) explicitly set as symlinks to somewhere (/var/lib/etc?). This simplifies the whole bookkeeping a lot, but however is a radical move. I'm eager to try implementing this but we need to survey possible cases when people manually change something in /etc. Maybe I'll get a chance asking in the ML...

@copumpkin
Copy link
Member

@abbradar in principle I'd like that, but in practice FHS is pretty unclear about whether /etc is supposed to be mutable. Would definitely be interested in what you came up with though. Personally, I'd rather fix more programs to not use /etc and rather to link directly to configuration in the store that they need (since we get more granularity there and know exactly what needs to be mutable), but that's probably a lot of work in some cases.

@ericsagnes
Copy link
Contributor

ericsagnes commented Jul 15, 2016

For input method packages, I used dedicated packages for the etc subfolders and added the folders under /etc/ via environment.pathsToLink.

Could a similar approach for /etc/fonts be a way to solve this problem? (edit: and accessorily a way to fix #16983 too?)

@obadz
Copy link
Contributor

obadz commented Jul 15, 2016

@copumpkin, why would we care what FHS says? :-D

@rasendubi
Copy link
Member

rasendubi commented Jul 17, 2016

I get this line when switching (and then fonts look ugly):

Warning: something's wrong at /nix/store/1hzvalfcpsrymaclgf1szqbsfrxvps4j-setup-etc.pl line 81.

Where 81 line is https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/system/etc/setup-etc.pl#L81.

Next fixes the fonts:

sudo rm /etc/fonts*
sudo nixos-rebuild switch

@rasendubi
Copy link
Member

Opened a PR with a fix: #17042.

@rasendubi
Copy link
Member

@abbradar see #3192 for read-only /etc

@abbradar
Copy link
Member

@rasendubi Nice find! I haven't yet done any research, so this thread will come handy.

rasendubi added a commit to rasendubi/nixpkgs that referenced this issue Jul 25, 2016
This patch adds handling of a directory becoming a symlink in
/etc. Before this patch, the directory wasn't removed and then
symlinking failed, which caused directory not being updated at all.

The idea for the patch goes to @abbradar at
NixOS#16978 (comment):
> A heuristic idea for this -- a function `isStatic :: Path -> Bool`:
>
> * if path `/etc/foo` is a file, return True iff it's a symlink to `/etc/static/foo`.
> * if path is a directory, return True iff for all items in it `isStatic` is True.
>
> On any conflicts, if old path is static, it's safe to replace and/or
> delete stale. Otherwise make a backup and notify the user via a
> journal entry and console output.

The only difference here -- it will not replace user configs.

This also fixes NixOS#16978.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.kind: bug Something is broken 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants