powerlevel10k icon indicating copy to clipboard operation
powerlevel10k copied to clipboard

Homebrew tap for MesloLGS NF?

Open carlocab opened this issue 4 years ago • 22 comments

Homebrew Cask also allows you to install fonts on macOS: https://github.com/Homebrew/homebrew-cask-fonts

I noticed that you maintain a Homebrew tap for powerlevel10k. Perhaps it also makes sense to do the same for your patched Meslo font?

This would allow you to automate the installation of fonts on macOS, even when the user isn't running iTerm2, as long as they also have brew.

Here's a cask for another version of the Meslo font: https://github.com/Homebrew/homebrew-cask-fonts/blob/master/Casks/font-meslo-lg-nerd-font.rb

carlocab avatar Oct 26 '20 22:10 carlocab

I'll do this when I get a free minute.

This would allow you to automate the installation of fonts on macOS, even when the user isn't running iTerm2

I can already do this. Installing the font doesn't require iTerm2. Currently p10k configure installs the font only when using iTerm2 because it knows how to change iTerm2 options to use the new font. If it were to install the font but not configure the terminal, I'm afraid I would get an endless stream of issues despite all the efforts I can put into urging users to change terminal settings manually.

romkatv avatar Oct 27 '20 07:10 romkatv

Oh, I see. My mistake.

carlocab avatar Oct 27 '20 12:10 carlocab

I'm also interested in automating the font installation and iTerm2 configuration.

My specific use case is a little different, I already manage my zsh config files via git. I'm looking for a way to install the fonts and configure iTerm2 without running through the entire p10k configure process.

This would be very helpful for me when I move to a new environment.

I would be happy just to have something likep10k configure fonts-only which could walk through the font portion of the wizard and then stop before I manage to mess up questions that I've already answered. :)

Thank you!

matthew-cox avatar Jan 12 '21 22:01 matthew-cox

@matthew-cox In order to install fonts on macOS, you need to download them and then move the files to ~/Library/Fonts (don't try to download directly into ~/Library/Fonts because if the OS ever sees an incomplete file in that directory it'll mark the font as broken). Links to MesloLGS ttf files can be found in https://github.com/romkatv/powerlevel10k/blob/master/font.md.

To change iTerm2 preferences (e.g., to change the font), you need to use defaults. From https://iterm2.com/faq.html:

Q: Where does iTerm2 store its settings?

A: Preferences, including profiles, are stored in ~/Library/Preferences/com.googlecode.iterm2.plist. To modify it, use the "defaults" command. For example, to delete all settings, run:

defaults delete com.googlecode.iterm2

Also see https://iterm2.com/documentation-hidden-settings.html.

romkatv avatar Jan 13 '21 08:01 romkatv

Would you mind if I go through the steps of https://github.com/Homebrew/homebrew-cask-fonts/blob/master/CONTRIBUTING.md to add MesloLGS NF into homebrew-cask-fonts?

This would allow people to install MesloLGS NF fonts via brew tap homebrew/cask-fonts && brew install font-meslolgs-nf

kalaschnik avatar Mar 29 '22 12:03 kalaschnik

You are free to do anything allowed by the license. I personally have issues with this.

Edit: Meant to say that I have no issues with this.

romkatv avatar Mar 29 '22 12:03 romkatv

Alright then I won’t dig into that; may I ask what are your concerns? MesloLGS NF could live in its own repo romkatv/meslolgs-nf and homebrew-cask-fonts would use that as a single source of truth, similar to the great font libertinus: https://github.com/Homebrew/homebrew-cask-fonts/blob/master/Casks/font-libertinus.rb

I am looking for a way to automatize font installation if I reset my system, without installing old versions of a font...

kalaschnik avatar Mar 29 '22 12:03 kalaschnik

Alright then I won’t dig into that; may I ask what are your concerns?

That's one of those unfortunate types that I keep making. Meant to say that I have no issues with this. Feel free to do anything that's legal. You don't need my permission beyond what you've already been granted by the license.

romkatv avatar Mar 29 '22 13:03 romkatv

Alright :), maybe there is a way I can link homebrew-cask-fonts to reference to fonts in your parent directory: https://github.com/romkatv/dotfiles-public/tree/master/.local/share/fonts/NerdFonts

Let’s see...

kalaschnik avatar Mar 29 '22 13:03 kalaschnik

You can copy the files.

romkatv avatar Mar 29 '22 13:03 romkatv

The fonts are here: https://github.com/romkatv/powerlevel10k#manual-font-installation

My dotfiles repo contains an old version of the font. I'm not deleting or updating it so that random scripts that depend on these files don't break.

romkatv avatar Mar 29 '22 13:03 romkatv

I was reading up the contribution guidelines, either we make (1) a PR to homebrew-cask-fonts, or (2) we make a PR to google-fonts repo, which would also be beneficial because your font would show up at google fonts?

In any case, according to both contribution guidelines, the font files need to be placed in a dedicated repository. I would rather want that the files live in your repository because I will never ever touch them if would create one. Would you mind creating a public romkatv/meslolgs-nf, then I would be happy to do the font submission, and push you some PRs to make the repo submission-compliant.

Anything against google-fonts? It is also the preferred homebrew way:

The preferred way to add a font to this repository is to submit it to Google Fonts. Shortly after its inclusion, a Cask will be automatically generated and updated on this repository.

kalaschnik avatar Mar 29 '22 14:03 kalaschnik

Would you mind creating a public romkatv/meslolgs-nf

If you can create the appropriate repo that I can simply clone, that would be perfect.

Anything against google-fonts?

Nope. No opinion whatsoever.

romkatv avatar Mar 29 '22 14:03 romkatv

I just saw the Nerd Font repo https://github.com/ryanoasis/nerd-fonts; hence the NF

I tried the latest version of Meslo LG S Nerd Font: https://github.com/ryanoasis/nerd-fonts/tree/master/patched-fonts/Meslo/S

Changed my terminal font it, and indeed the spacing test fails: image

And a lot of other glitches appear in this font.

Out of curiosity (I am writing some background information in the repo) — Did you clone at some point a version of the Meslo LG S Nerd Font from the Nerd Fonts repo and then made a bunch of adaptions until it finally looks right for powerlevel10k?

kalaschnik avatar Mar 29 '22 19:03 kalaschnik

See https://github.com/romkatv/powerlevel10k#how-was-the-recommended-font-created

romkatv avatar Mar 29 '22 20:03 romkatv

I think it's worth pointing out the 7 commits Roman made when he forked the NF repo to vastly improve the spacing of Meslo LG S... ❤️

eddyg avatar Mar 29 '22 21:03 eddyg

Out of all the people with contributions to the creation of this font, mine were the smallest. It's just a bit of tuning.

By the way, you can build other fonts (like Hack and whatnot) from my repo and they'll have the same icons with the same bearings, etc. I haven't verified that it works with all fonts though.

romkatv avatar Mar 29 '22 22:03 romkatv

I tested font-meslo-lg-nerd-font from https://github.com/Homebrew/homebrew-cask-fonts and that renders perfectly. All the spacing, rotation etc is correct image

Maybe no need to maintain the font separately anymore as the upstream works fine now?

Moulick avatar Nov 26 '22 11:11 Moulick

The icons on your screenshot are too small.

romkatv avatar Nov 26 '22 11:11 romkatv

yeah, you are right, just compared your and upstream. Yours is bigger in size and actually fits better. I wish these changes could be upstreamed. Any hopes of that happening?

Moulick avatar Nov 26 '22 11:11 Moulick

I wish these changes could be upstreamed. Any hopes of that happening?

My changes are open source with a permissive license. Go ahead and try to push them upstream if this is something you care about.

romkatv avatar Nov 26 '22 11:11 romkatv

I started going through the changes and trying to figure out how to, might be out of my wheelhouse to tackle though ☹️

Moulick avatar Nov 26 '22 15:11 Moulick