blue-build / modules

BlueBuild standard modules used for building your Atomic Images
Apache License 2.0
24 stars 25 forks source link

feat: fonts module #52

Closed lucasvsr closed 11 months ago

lucasvsr commented 11 months ago

fonts installation module

Use it to install nerd-fonts or google-fonts. This module will run each build always downloading the latest version from properly configured fonts.

Configuration example


- type: fonts
  fonts:
    nerd-fonts:
      - FiraCode # don't add "Nerd Font" suffix.
      - Hack
      - SourceCodePro
      - Terminus
      - JetBrainsMono
      - NerdFontsSymbolsOnly
    google-fonts:
      - Roboto
      - Open Sans
xynydev commented 11 months ago

Thank you, this is certainly very cool. I don't have time to read the code for a while now, but font installation is for sure one of the things bling was made to fix.

This makes me wonder; shouldn't we make another one for google fonts or a similar service, and if we do, should we just remove the Inter & Ubuntu font files from bling and completely rely on the module?

lucasvsr commented 11 months ago

Thank you, this is certainly very cool. I don't have time to read the code for a while now, but font installation is for sure one of the things bling was made to fix.

This makes me wonder; shouldn't we make another one for google fonts or a similar service, and if we do, should we just remove the Inter & Ubuntu font files from bling and completely rely on the module?

Thanks! I created this module to always have the latest version of the fonts, periodically looking at the nerd-fonts repository wasn't that productive...

About doing something similar with Google fonts, I can try and if I succeed, I'll open the PR here. What you think?

tulilirockz commented 11 months ago

That would be really sweet! Shouldn't be too hard to adapt the code to use the Google fonts thing instead!

tulilirockz commented 11 months ago

Also, yeah, we should rely just on the module instead of shipping the fonts ourselves, it'll both decrease the maintenance burden and make it more reliable for users to install those fonts

xynydev commented 11 months ago

Here’s an idea I had; Assuming there’s going to be other font download sources than nerd fonts, I think it would make more sense to have them all inside one module. This would work similary to the bling module, which has a directory full of installer scripts for different parts of bling. These font installer scripts could just take in the fonts as shell arguments (instead of JSON) making them usable accross non-startingpoint projects (in Bluefin for installing Ubuntu & Inter for example).

The config could look something like this (normalized):

type: fonts
install:
    - source: nerd-fonts
      fonts: 
           - Iosevka
           - Hack
           - SpaceMono

Or this (simplified):

type: fonts
nerd-fonts:
    - Iosevka
    - Hack
    - SpaceMono
lucasvsr commented 11 months ago

Here’s an idea I had; Assuming there’s going to be other font download sources than nerd fonts, I think it would make more sense to have them all inside one module. This would work similary to the bling module, which has a directory full of installer scripts for different parts of bling. These font installer scripts could just take in the fonts as shell arguments (instead of JSON) making them usable accross non-startingpoint projects (in Bluefin for installing Ubuntu & Inter for example).

The config could look something like this (normalized):

type: fonts
install:
    - source: nerd-fonts
      fonts: 
           - Iosevka
           - Hack
           - SpaceMono

Or this (simplified):

type: fonts
nerd-fonts:
    - Iosevka
    - Hack
    - SpaceMono

OK! I had finished the Google-Fonts module, but I think you can do this adaptation. This PR should be closed, then?

xynydev commented 11 months ago

OK! I had finished the Google-Fonts module, but I think you can do this adaptation.

Great!

This PR should be closed, then?

We can adapt this one too, you can make the changes yourself or (unless I already have them) give me write priviliges and I can do it after you merge the google fonts module into this PR. You've done great work for this and we don't wanna lose you from the commit history.

lucasvsr commented 11 months ago

OK! I had finished the Google-Fonts module, but I think you can do this adaptation.

Great!

This PR should be closed, then?

We can adapt this one too, you can make the changes yourself or (unless I already have them) give me write priviliges and I can do it after you merge the google fonts module into this PR. You've done great work for this and we don't wanna lose you from the commit history.

I made a commit with the new module.

xynydev commented 11 months ago

Great, I'll redo the review when I have time.

General notes:

lucasvsr commented 11 months ago

Great, I'll redo the review when I have time.

General notes:

  • No separate install scripts as a I suggested. Did you forget this or are you against it (please present reasons)?
  • The YAML indentatation in the example configuration is broken (each sequential key is indented one step more, even though they do not nest)
  • Most comments from my previous review still apply.
xynydev commented 11 months ago

No separate install scripts as a I suggested. Did you forget this or are you against it (please present reasons)?

I prefer to keep a single script and create a generic function. I didn't think the size of the script was worth the work.

I undersrand but disagree. The purpose of having multiple scripts is maximum reausability, making it possible to use the font download scripts even if not using ublue-os/startingpoint. I understand that this will create more work, but I think it is worth it. An alternative to a generalized download function could be a download.sh script, or maybe we could just have the individual scripts run source ../fonts.sh to get the function. Of course, feel free to argue back and I'll get more people to give opinions.

lucasvsr commented 11 months ago

No separate install scripts as a I suggested. Did you forget this or are you against it (please present reasons)?

I prefer to keep a single script and create a generic function. I didn't think the size of the script was worth the work.

I undersrand but disagree. The purpose of having multiple scripts is maximum reausability, making it possible to use the font download scripts even if not using ublue-os/startingpoint. I understand that this will create more work, but I think it is worth it. An alternative to a generalized download function could be a download.sh script, or maybe we could just have the individual scripts run source ../fonts.sh to get the function. Of course, feel free to argue back and I'll get more people to give opinions.

I understand that reusability is a good thing, but in this case I see no reason to do something so generic, since it is a specific module for downloading fonts for the Ublue project, which as far as I know is the only one that takes advantage of what we are doing here.

I even tried to create something very generic, but as I did so, I returned to the reflection I made in the paragraph above.

lucasvsr commented 11 months ago

Hey guys!

I made a series of changes to make the script more organized and aiming for maximum reusability. I believe this way meets what @xynydev has been commenting on throughout this thread.

xynydev commented 11 months ago

I understand that reusability is a good thing, but in this case I see no reason to do something so generic, since it is a specific module for downloading fonts for the Ublue project, which as far as I know is the only one that takes advantage of what we are doing here.

The point was that we could get this improvement to other ublue repos as well, like Bluefin, that don't use startingpoint's systems. And get Jorge interested like that, lol.

I made a series of changes to make the script more organized and aiming for maximum reusability. I believe this way meets what @xynydev has been commenting on throughout this thread.

I love it, thanks!