danth / stylix

System-wide colorscheming and typography for NixOS
https://stylix.danth.me/
MIT License
906 stars 105 forks source link

plymouth: set custom font #339

Open Jeidnx opened 2 months ago

Jeidnx commented 2 months ago

Sets the user configured font in plymouth. On my setup plymouth only seemed to accept / work with truetype fonts and i didn't find any documentation for plymouth mentioning fonts at all, so the script checks for that first and falls back to converting another font format to ttf with fontforge.

danth commented 2 months ago

@trueNAHO Requesting a review since you've been doing a lot of work around bash scripts recently, so you may be interested in this new one.

Jeidnx commented 1 month ago

I have since read more about fonts in plymouth and as i understand it only truetype and opentype are supported with opentype being the preferred format. I am not sure if there is a way to have the derivation point to a .otf or .ttf file, or if the extension even needs to be in the name of the derivation for that matter, so i chose to ignore truetype and convert everything that is not already opentype to that format instead. If anyone has a way of allowing both formats input would be appreciated :)

trueNAHO commented 1 month ago

I have since read more about fonts in plymouth and as i understand it only truetype and opentype are supported with opentype being the preferred format. I am not sure if there is a way to have the derivation point to a .otf or .ttf file, or if the extension even needs to be in the name of the derivation for that matter, so i chose to ignore truetype and convert everything that is not already opentype to that format instead. If anyone has a way of allowing both formats input would be appreciated :)

I have not done any further research on this, but would it be possible to extract the font types from certain paths? Maybe the nerdfont package is helpfull: https://github.com/NixOS/nixpkgs/blob/nixos-23.11/pkgs/data/fonts/nerdfonts/default.nix.

For reference, there is an open issue regarding fonts: https://github.com/danth/stylix/issues/308.