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

noto-fonts-emoji: promises inexistent black-and-white version #221181

Closed
dschrempf opened this issue Mar 14, 2023 · 11 comments · Fixed by #254149
Closed

noto-fonts-emoji: promises inexistent black-and-white version #221181

dschrempf opened this issue Mar 14, 2023 · 11 comments · Fixed by #254149
Labels
0.kind: bug Something is broken

Comments

@dschrempf
Copy link
Contributor

Describe the bug

The description of noto-fonts-emoji promises "Color and Black-and-White emoji fonts". However, only the "Noto Color Emoji" version is available after installation.

Steps To Reproduce

  1. Add noto-fonts-emoji to fonts.fonts in the NixOS configuration.
  2. Search through available fonts using font-manager.

Expected behavior

The black and white version is also available.

Notes

I noticed on the upstream repository that the "The black-and-white emoji font is back under active development", so maybe this is the cause?

@dschrempf dschrempf added the 0.kind: bug Something is broken label Mar 14, 2023
@RamKromberg
Copy link
Contributor

Google makes it available as two separate font families here:
https://fonts.google.com/noto/specimen/Noto+Emoji
https://fonts.google.com/noto/specimen/Noto+Color+Emoji

So, two separate downloads:
https://fonts.google.com/download?family=Noto%20Emoji
https://fonts.google.com/download?family=Noto%20Color%20Emoji

Unfortunately, the google upstream github repository didn't make the .ttf available on github so nixpkgs didn't pick it up. In fact, even Fedora - which fetches and builds the normal color version from source - didn't build the font and instead just downloaded the pre-built zip and added it into their source package manually:

Source4:        Noto_Emoji.zip

...

# Pre-built, and included with the source:
--
  | install -m 0644 -p fonts/NotoColorEmoji.ttf %{buildroot}%{_fontdir}

( https://src.fedoraproject.org/rpms/google-noto-emoji-fonts/blob/rawhide/f/google-noto-emoji-fonts.spec )

The separate hashes listed here: https://src.fedoraproject.org/rpms/google-noto-emoji-fonts/blob/rawhide/f/sources

And their rpms for both source and outputs can be downloaded here: https://koji.fedoraproject.org/koji/buildinfo?buildID=2118241

Their copy of .zip is here: https://src.fedoraproject.org/lookaside/extras/google-noto-emoji-fonts/Noto_Emoji.zip

@dschrempf
Copy link
Contributor Author

Impressive analysis, thanks!

@bd-g
Copy link

bd-g commented May 15, 2023

Does anyone know how often the black and white ttf (that is hosted on fonts.google.com, but source is not released on GitHub) has been updated?

I would like this font, and would submit a PR that fetches from font.google.com. However, you can't pin a version since it's just a download without source, and I have no idea how often it is updated and therefore a hash update would be required.

@RamKromberg
Copy link
Contributor

@bd-g they have an API that returns version numbers (and last modified date) here: https://developers.google.com/fonts/docs/developer_api

e.g. Using the side-bar explorer, "Noto Emoji" currently returns:

{
  "kind": "webfonts#webfontList",
  "items": [
    {
      "family": "Noto Emoji",
      "variants": [
        "300",
        "regular",
        "500",
        "600",
        "700"
      ],
      "subsets": [
        "emoji"
      ],
      "version": "v39",
      "lastModified": "2023-03-21",
      "files": {
        "300": "http://fonts.gstatic.com/s/notoemoji/v39/bMrnmSyK7YY-MEu6aWjPDs-ar6uWaGWuob_10jwvS-FGJCMY.ttf",
        "regular": "http://fonts.gstatic.com/s/notoemoji/v39/bMrnmSyK7YY-MEu6aWjPDs-ar6uWaGWuob-r0jwvS-FGJCMY.ttf",
        "500": "http://fonts.gstatic.com/s/notoemoji/v39/bMrnmSyK7YY-MEu6aWjPDs-ar6uWaGWuob-Z0jwvS-FGJCMY.ttf",
        "600": "http://fonts.gstatic.com/s/notoemoji/v39/bMrnmSyK7YY-MEu6aWjPDs-ar6uWaGWuob911TwvS-FGJCMY.ttf",
        "700": "http://fonts.gstatic.com/s/notoemoji/v39/bMrnmSyK7YY-MEu6aWjPDs-ar6uWaGWuob9M1TwvS-FGJCMY.ttf"
      },
      "category": "sans-serif",
      "kind": "webfonts#webfont",
      "menu": "http://fonts.gstatic.com/s/notoemoji/v39/bMrnmSyK7YY-MEu6aWjPDs-ar6uWaGWuob-r0gwuQeU.ttf"
    }
  ]
}

While "Noto Color Emoji" returns:

{
  "kind": "webfonts#webfontList",
  "items": [
    {
      "family": "Noto Color Emoji",
      "variants": [
        "regular"
      ],
      "subsets": [
        "emoji"
      ],
      "version": "v24",
      "lastModified": "2022-09-26",
      "files": {
        "regular": "http://fonts.gstatic.com/s/notocoloremoji/v24/Yq6P-KqIXTD0t4D9z1ESnKM3-HpFab5s79iz64w.ttf"
      },
      "category": "sans-serif",
      "kind": "webfonts#webfont",
      "menu": "http://fonts.gstatic.com/s/notocoloremoji/v24/Yq6P-KqIXTD0t4D9z1ESnKM3-HpFWb9m6w.ttf"
    }
  ]
}

Unfortunately, it requires an API key.

@bd-g
Copy link

bd-g commented May 18, 2023

@bd-g they have an API that returns version numbers (and last modified date) here: https://developers.google.com/fonts/docs/developer_api

e.g. Using the side-bar explorer, "Noto Emoji" currently returns:

{
  "kind": "webfonts#webfontList",
  "items": [
    {
      "family": "Noto Emoji",
      "variants": [
        "300",
        "regular",
        "500",
        "600",
        "700"
      ],
      "subsets": [
        "emoji"
      ],
      "version": "v39",
      "lastModified": "2023-03-21",
      "files": {
        "300": "http://fonts.gstatic.com/s/notoemoji/v39/bMrnmSyK7YY-MEu6aWjPDs-ar6uWaGWuob_10jwvS-FGJCMY.ttf",
        "regular": "http://fonts.gstatic.com/s/notoemoji/v39/bMrnmSyK7YY-MEu6aWjPDs-ar6uWaGWuob-r0jwvS-FGJCMY.ttf",
        "500": "http://fonts.gstatic.com/s/notoemoji/v39/bMrnmSyK7YY-MEu6aWjPDs-ar6uWaGWuob-Z0jwvS-FGJCMY.ttf",
        "600": "http://fonts.gstatic.com/s/notoemoji/v39/bMrnmSyK7YY-MEu6aWjPDs-ar6uWaGWuob911TwvS-FGJCMY.ttf",
        "700": "http://fonts.gstatic.com/s/notoemoji/v39/bMrnmSyK7YY-MEu6aWjPDs-ar6uWaGWuob9M1TwvS-FGJCMY.ttf"
      },
      "category": "sans-serif",
      "kind": "webfonts#webfont",
      "menu": "http://fonts.gstatic.com/s/notoemoji/v39/bMrnmSyK7YY-MEu6aWjPDs-ar6uWaGWuob-r0gwuQeU.ttf"
    }
  ]
}

While "Noto Color Emoji" returns:

{
  "kind": "webfonts#webfontList",
  "items": [
    {
      "family": "Noto Color Emoji",
      "variants": [
        "regular"
      ],
      "subsets": [
        "emoji"
      ],
      "version": "v24",
      "lastModified": "2022-09-26",
      "files": {
        "regular": "http://fonts.gstatic.com/s/notocoloremoji/v24/Yq6P-KqIXTD0t4D9z1ESnKM3-HpFab5s79iz64w.ttf"
      },
      "category": "sans-serif",
      "kind": "webfonts#webfont",
      "menu": "http://fonts.gstatic.com/s/notocoloremoji/v24/Yq6P-KqIXTD0t4D9z1ESnKM3-HpFWb9m6w.ttf"
    }
  ]
}

Unfortunately, it requires an API key.

Great find - I didn't look hard enough obviously. I'm fairly new to Nix, do we have a standard procedure or any way of getting around the API key? If I wrote my own overlay, is there a resource you can point me to to pass an API key to fetchTarball or something like that?

@RamKromberg
Copy link
Contributor

do we have a standard procedure or any way of getting around the API key?

No idea. I suspect a core nix dev would have a way to handle secret keys (as they're probably necessary for hydra builds and such)... But I'm very inactive in Nix and Nixpkgs development so I wouldn't even know where to ask.

If I wrote my own overlay, is there a resource you can point me to to pass an API key to fetchTarball or something like that?

I've seen a few packages like plausible where a script is used to download the json and then processed it with builtins.fromJSON. I guess it would be fine to write it to take the API key as a variable and leave a comment for the maintainers about the issue and how they can circumvent the problem by using the side-bar explorer and manually copy-paste the updated json... It ain't pretty but it will leave the repo with a reproducible copy of the json so...

@bd-g
Copy link

bd-g commented May 20, 2023

To all, I made this font available through the NUR here. Might work to add it to nixpkgs in the future.

@RamKromberg
Copy link
Contributor

Haven't tested it but it LGTM. Then again, it's the first time I'm hearing about the NUR or secrets so maybe people who don't live under a rock will have a different opinion... :D

@dschrempf
Copy link
Contributor Author

Why is the black and white font hidden behind an API? Is it legal to expose the hidden URL including the hash in Nixpkgs? I doubt that. Where do we check this? Does the hidden URL change (i.e., is it created "on demand"?).

With respect to the code in the NUR, I have the following suggestions/questions:

  • google -> Google (description)
  • Why do you define all variables in the let expression when you only inherit them or use them once?

@bd-g
Copy link

bd-g commented May 22, 2023

Why is the black and white font hidden behind an API? Is it legal to expose the hidden URL including the hash in Nixpkgs? I doubt that. Where do we check this? Does the hidden URL change (i.e., is it created "on demand"?).

With respect to the code in the NUR, I have the following suggestions/questions:

  • google -> Google (description)
  • Why do you define all variables in the let expression when you only inherit them or use them once?

Thanks for the feedback! Always willing the learn and adjust.

Legally, I was mainly thinking of the font license. I’m not sure about the URL question to be honest. That’s one reason I kept it in the NUR, I’m fine taking responsibility for it, I don’t use google products so I’m fine with them coming at me. Let me know if I should think about that different in terms of exposing the nix community through the NUR.

The hidden URL can change as things are updated, so I don’t have to manually do it. See update.sh, which is modeled after the same idea used in the ‘plausible’ package in nixpkgs.

I’ll adjust the description.

For me, it is more readable to have those variables at the top of the file. Additionally, it made the regex is “update.sh” a lot easier.

@dschrempf
Copy link
Contributor Author

dschrempf commented May 22, 2023

I see, thank you. Looks like getting this font and keeping it updated is much more complicated than it should be...

nbraud added a commit to nbraud/nixpkgs that referenced this issue Sep 12, 2023
Clarify that the monochrome font is not included, per NixOS#221181.

The new name is also coherent with the name of the font,
according to `fontconfig`: Noto Color Emoji.
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
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants