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

fonts.fontconfig.defaultFonts.emoji does not work for some fonts #86713

Open
justinlovinger opened this issue May 4, 2020 · 11 comments
Open
Labels
0.kind: bug 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md

Comments

@justinlovinger
Copy link
Contributor

Describe the bug
fonts.fontconfig.defaultFonts.emoji does not change the emoji font, whether or not fonts.fontconfig.penultimate.enable = true is set.

To Reproduce
Steps to reproduce the behavior:

  1. Set fonts.fontconfig.defaultFonts.emoji = [ "DejaVu Sans Mono" ]
  2. Run fc-match emoji to check font

Expected behavior
fc-match emoji should output "DejaVu Sans Mono".

Additional context
The font set with fonts.fontconfig.defaultFonts.emoji appears as the second to top font in fc-match -s emoji. If you add a ~/.fonts.conf with

<?xml version='1.0'?>
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
<fontconfig>
  <alias binding="strong">
    <family>emoji</family>
    <prefer>
      <family>DejaVu Sans Mono</family>
    </prefer>
  </alias>
</fontconfig>

the given font is still second from top in fc-match -s emoji.

With fonts.fontconfig.penultimate.enable = true, it looks like a different issue, with a similar result. With fonts.fontconfig.penultimate.enable = true, changing fonts.fontconfig.defaultFonts.emoji has no effect on fc-match -s emoji. It looks like emoji font is not set in fontconfig-penultimate.nix. With fonts.fontconfig.penultimate.enable = true, the above ~/.fonts.conf file does change the emoji font.

Notify maintainers

Metadata
Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

  • system: "x86_64-linux"
  • host os: Linux 5.4.35, NixOS, 20.03.1619.ab3adfe1c76 (Markhor)
  • multi-user?: yes
  • sandbox: yes
  • version: nix-env (Nix) 2.3.4
  • channels(root): "nixos-20.03.1619.ab3adfe1c76"
  • nixpkgs: /nix/var/nix/profiles/per-user/root/channels/nixos

Maintainer information:

# a list of nixpkgs attributes affected by the problem
attribute:
# a list of nixos modules affected by the problem
module: fonts.fontconfig
@veprbl
Copy link
Member

veprbl commented May 5, 2020

Relevant to #86601

@worldofpeace worldofpeace changed the title fonts.fontconfig.defaultFonts.emoji does not work fonts.fontconfig.defaultFonts.emoji does not work with penultimate fontconfig Aug 6, 2020
@worldofpeace
Copy link
Contributor

I've noted that it's with penultimate fontconfig where this option doesn't work, which we were aware of and why penultimate is no longer the default.

@justinlovinger
Copy link
Contributor Author

I've noted that it's with penultimate fontconfig where this option doesn't work, which we were aware of and why penultimate is no longer the default.

Has fonts.fontconfig.defaultFonts.emoji been fixed without penultimate fontconfig, since this issue was made? When I made this issue, fonts.fontconfig.defaultFonts.emoji did not work, even without penultimate fontconfig. See my original description of this bug.

@worldofpeace
Copy link
Contributor

I'm seeing that your test was fc-match -s emoji and we've actually tested that continuously since the option was added in https://github.com/NixOS/nixpkgs/blob/master/nixos/tests/fontconfig-default-fonts.nix#L31. We even install two emoji fonts to be sure https://github.com/NixOS/nixpkgs/blob/master/nixos/tests/fontconfig-default-fonts.nix#L13. Could you try with these fonts

fonts.fonts = with pkgs; [
      noto-fonts-emoji
      twitter-color-emoji
 ];

and

fonts.fontconfig.defaultFonts = {
   emoji = [ "Twitter Color Emoji" ];
 };

testing with fc-match emoji | grep '\"Twitter Color Emoji\"'?

@justinlovinger
Copy link
Contributor Author

Your test works. However

fonts.fonts = with pkgs; [
  noto-fonts-emoji
];
fonts.fontconfig.defaultFonts = {
  emoji = [ "Noto Emoji" ];
};

with fc-match emoji | grep '\"Noto Emoji\"' and

fonts.fonts = with pkgs; [
  dejavu_fonts
  noto-fonts-emoji
];
fonts.fontconfig.defaultFonts = {
  emoji = [ "DejaVu Sans Mono" ];
};

with fc-match emoji | grep '\"DejaVu Sans Mono\"'

does not work. In both cases, the top emoji font is "Noto Color Emoji" instead of the configured default emoji.

@justinlovinger justinlovinger changed the title fonts.fontconfig.defaultFonts.emoji does not work with penultimate fontconfig fonts.fontconfig.defaultFonts.emoji does not work for some fonts Sep 5, 2020
@stale
Copy link

stale bot commented Mar 5, 2021

I marked this as stale due to inactivity. → More info

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Mar 5, 2021
@jtojnar
Copy link
Member

jtojnar commented Mar 7, 2021

Only fonts that fontconfig knows as emoji fonts can be used: https://gitlab.freedesktop.org/fontconfig/fontconfig/-/blob/d263d4075ea90f7a296c4d65e69eea504906689e/conf.d/60-generic.conf#L25-47

Note that fontconfig matches color emoji fonts preferentially,
so if you want to use a black and white font while having
a color font installed (eg. Noto Color Emoji installed alongside
Noto Emoji), fontconfig will still choose the color font even
when it is later in the list.

@stale stale bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Mar 7, 2021
@stale
Copy link

stale bot commented Sep 3, 2021

I marked this as stale due to inactivity. → More info

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Sep 3, 2021
@maydayv7
Copy link

maydayv7 commented Oct 5, 2021

Still an issue

@stale stale bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Oct 5, 2021
@stale
Copy link

stale bot commented Apr 17, 2022

I marked this as stale due to inactivity. → More info

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Apr 17, 2022
@HenriAW
Copy link

HenriAW commented Dec 30, 2022

+1

@stale stale bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Dec 30, 2022
@SuperSandro2000 SuperSandro2000 added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jul 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.kind: bug 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md
Projects
None yet
Development

No branches or pull requests

7 participants