NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.87k stars 13.93k forks source link

Gajim: No emojis #222438

Open davidak opened 1 year ago

davidak commented 1 year ago

Describe the bug

The emoji picker shows no emojis.

Similar issue before https://github.com/NixOS/nixpkgs/issues/83053

Steps To Reproduce

Steps to reproduce the behavior:

  1. join chat
  2. click emoji picker

Expected behavior

Working emojis

Screenshots

Screenshot from 2023-03-22 00-24-51

Additional context

Using Gajim 1.6.1 from unstable channel.

On System with Pantheon desktop.

Maybe a dependency with emojis is missing?

(I don't use it, so i don't care if it get's fixed. Others might.)

Notify maintainers

@abbradar

Metadata

Artturin commented 1 year ago

Perhaps you have to enter one of those categories?

davidak commented 1 year ago

@Artturin no, i can't click there.

it works in the flathub version

Screenshot from 2023-03-22 05-29-25

For Gajim on Linux and Windows (and soon for MacOS as well), emojis are handled by GTK.

Source: https://dev.gajim.org/gajim/gajim/-/issues/11001

def try_load_raw_emoji_data(locale: str) -> Optional[GLib.Bytes]:
    # Sources of emoji data can be found at:
    # https://gitlab.gnome.org/GNOME/gtk/-/tree/main/gtk/emoji
    emoji_data_resource = f'/org/gtk/libgtk/emoji/{locale}.data'

https://dev.gajim.org/gajim/gajim/-/blob/master/gajim/gtk/emoji_data_gtk.py#L97

    # some distribution do not register locale emoji resources, so let's do it
    try:
        res = Gio.resource_load(f'/usr/share/gtk-3.0/emoji/{locale}.gresource')

i have

[davidak@gaming:~]$ ll /var/run/current-system/sw/share/gtk-3.0/emoji/
total 452
-r--r--r-- 1 root root 131515 Jan  1  1970 de.gresource
-r--r--r-- 1 root root 117840 Jan  1  1970 es.gresource
-r--r--r-- 1 root root 106508 Jan  1  1970 fr.gresource
-r--r--r-- 1 root root  96516 Jan  1  1970 zh.gresource

the files are coming from /nix/store/qlr50zihdb0g1ngm6vi5m3r5qldi22v2-gtk+3-3.24.35/share/gtk-3.0. why is en missing?

https://gitlab.gnome.org/GNOME/gtk/-/tree/3.24.35/gtk/emoji

i built gtk3 and did not see a related error

[168/1203] Generating gtk/de_gresource with a custom command
[169/1203] Generating gtk/fr_gresource with a custom command
[170/1203] Generating gtk/es_gresource with a custom command
[171/1203] Generating gtk/zh_gresource with a custom command

...

Installing gtk/de.gresource to /nix/store/j3irf2yvy357qhgknkdzl9xkvvivnn92-gtk+3-3.24.36/share/gtk-3.0/emoji
Installing gtk/fr.gresource to /nix/store/j3irf2yvy357qhgknkdzl9xkvvivnn92-gtk+3-3.24.36/share/gtk-3.0/emoji
Installing gtk/es.gresource to /nix/store/j3irf2yvy357qhgknkdzl9xkvvivnn92-gtk+3-3.24.36/share/gtk-3.0/emoji
Installing gtk/zh.gresource to /nix/store/j3irf2yvy357qhgknkdzl9xkvvivnn92-gtk+3-3.24.36/share/gtk-3.0/emoji

terminal output:

03/22/2023 05:43:14 (I) gajim.gtk.emoji_data_gtk   Loading emoji data; application locale is en_US
03/22/2023 05:43:14 (D) gajim.gtk.emoji_data_gtk   Trying locales ['en_US', 'en']
03/22/2023 05:43:14 (I) gajim.gtk.emoji_data_gtk   Loading emoji data resource for locale en_US failed: g-resource-error-quark: The resource at “/org/gtk/libgtk/emoji/en_US.data” does not exist (0)
03/22/2023 05:43:14 (I) gajim.gtk.emoji_data_gtk   Loaded emoji data resource for locale en
03/22/2023 05:43:14 (D) gajim.gtk.emoji_data_gtk   Null codepoint for short name "light skin tone", found U+1F3FB
03/22/2023 05:43:14 (D) gajim.gtk.emoji_data_gtk   Null codepoint for short name "medium-light skin tone", found U+1F3FC
03/22/2023 05:43:14 (D) gajim.gtk.emoji_data_gtk   Null codepoint for short name "medium skin tone", found U+1F3FD
03/22/2023 05:43:14 (D) gajim.gtk.emoji_data_gtk   Null codepoint for short name "medium-dark skin tone", found U+1F3FE
03/22/2023 05:43:14 (D) gajim.gtk.emoji_data_gtk   Null codepoint for short name "dark skin tone", found U+1F3FF
sokai commented 1 year ago

Thanks for the report, I'm also in with the stable channel … :-/

$ ll /var/run/current-system/sw/share/gtk-3.0/emoji/
total 452
-r--r--r-- 1 root root 131515  1. Jan 1970  de.gresource
-r--r--r-- 1 root root 117840  1. Jan 1970  es.gresource
-r--r--r-- 1 root root 106508  1. Jan 1970  fr.gresource
-r--r--r-- 1 root root  96516  1. Jan 1970  zh.gresource

$ gtk-launch --version
3.24.37

After the good investigation from @davidak it seems a gtk issue, right? So maybe @bobby285271 or @simplejack-src could take a look here?

Thanks in advane + KR

sokai commented 1 year ago

After some self-investigation I don't think it's a gtk issue. For me it is/was more an font/fontconfig issue with my configuration and I'll share some points that may help.

@davidak : Just try to open up Gnome Characters. For me all emojis where there but 95% empty and only ~5% visible. Maybe you have the same, so something with your fonts is also mixed-up. :-/

I changed a lot in my (new/beginner) config and came up with a working Gnome Emoji Picker (and also Gnome Characters shows all emojis) with the same output from ll /var/run/current-system/sw/share/gtk-3.0/emoji/ (see above).

At the end I currently run with this (AFAIK more or less relevant) options (for my dual-language system: system/desktop lang en + de inputs/location):

  console.useXkbConfig = true;

  fonts = {
    fonts = with pkgs; [
      corefonts # Microsoft free fonts
      dejavu_fonts
      noto-fonts
      noto-fonts-cjk
      noto-fonts-emoji
      source-code-pro
      source-sans-pro
      source-serif-pro
      ttf_bitstream_vera
      # and some more individual fonts …
    ];
    enableDefaultFonts = true;
    enableGhostscriptFonts = true;
    fontconfig = {
      antialias = true;
      cache32Bit = true;
      enable = true;
      defaultFonts = {
        emoji = ["Noto Color Emoji"];
        monospace = [ "Noto Mono" ];
        sansSerif = [ "Noto Sans" ];
        serif = [ "Noto Serif" ];
      };
      hinting.autohint = true;
      hinting.enable = true;
      hinting.style = "hintslight";
    };
    fontDir.enable = true;
  };

  home-manager.users.sokai = { lib, ... }: {
    dconf = {
      enable = true;
      settings = {
        "org/gnome/desktop/input-sources" = {
          sources = [ (lib.hm.gvariant.mkTuple [ "xkb" "de+deadgraveacute" ]) ];
          xkb-options = [ "caps:none" ]; # NEVER SCREAM!
        };
        "org/gnome/desktop/interface" = {
          document-font-name = "Source Sans Pro 10";
          font-antialiasing = "rgba";
          font-hinting = "slight";
          font-name = "Source Sans Pro 10";
          monospace-font-name = "Source Code Pro 9";
          #scaling-factor = 1;
          #text-scaling-factor = 0.95;
        };
        "org/gnome/desktop/wm/preferences" = {
          focus-mode = "sloppy";
          titlebar-font = "Source Sans Pro Semibold 10";
        };
        "system/locale" = {
          region = "de_DE.UTF-8";
        };
    };
    home =  {
      keyboard = {
        layout = "de";
        variant = "deadgraveacute";
      };
      language.base = "en_GB.UTF-8";
    };
  };

  i18n = {
    defaultLocale = "en_GB.UTF-8";
    supportedLocales = [
      "de_DE.UTF-8/UTF-8"
      "en_GB.UTF-8/UTF-8"
    ];
  };

KR

l0b0 commented 1 year ago

This was both necessary and sufficient to fix missing emoji such as "🛇":

{
  fonts.fonts = [
    pkgs.noto-fonts
  ];
}