romkatv / powerlevel10k

A Zsh theme
MIT License
45.85k stars 2.17k forks source link

Homebrew tap for MesloLGS NF? #1071

Closed carlocab closed 4 months ago

carlocab commented 3 years ago

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

romkatv commented 3 years ago

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.

carlocab commented 3 years ago

Oh, I see. My mistake.

matthew-cox commented 3 years ago

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!

romkatv commented 3 years ago

@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.

kalaschnik commented 2 years ago

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

romkatv commented 2 years ago

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.

kalaschnik commented 2 years ago

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...

romkatv commented 2 years ago

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

That's one of those unfortunate typos 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.

kalaschnik commented 2 years ago

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...

romkatv commented 2 years ago

You can copy the files.

romkatv commented 2 years ago

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.

kalaschnik commented 2 years ago

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.

romkatv commented 2 years ago

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.

kalaschnik commented 2 years ago

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?

romkatv commented 2 years ago

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

eddyg commented 2 years ago

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... ❤️

romkatv commented 2 years ago

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.

Moulick commented 1 year ago

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?

romkatv commented 1 year ago

The icons on your screenshot are too small.

Moulick commented 1 year ago

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?

romkatv commented 1 year ago

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.

Moulick commented 1 year ago

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

kalip2 commented 8 months ago

@romkatv Earlier, you all talked about adding your patched fonts to Google Fonts, so Homebrew could automatically use them. I made a new GitHub repo called font-meslo-for-powerlevel10k using googlefonts-project-template. However, the setup instructions asked for a .glyph file in the sources folder, whch I'm not familiar with. As a quick fix, I removed fonts/ from .gitignore, made a new folder for fonts, and put your patched ttf fonts there. I also created a font-meslo-for-powerlevel10k cask and submitted a PR to homebrew-cask-fonts.

If the PR is approved, install should be as simple as brew install font-meslo-for-powerlevel10k

I've sent a request to transfer ownership of the font-meslo-for-powerlevel10k repo over to you.

Screenshot 2024-02-02 at 5 33 01 PM

romkatv commented 7 months ago

I appreciate that you are trying to help but I'm not comfortable with this approach. If you are going to create a repo and transfer ownership to me, please ask me first. I am not accepting the ownership of this repo because of the name (I don't want to own a repo with someone else's name in it, whom I do not know), and because there is too much code for me to verify (it's way easier to generate code from a template than to verify the result when someone else claims to have used the generator). The PR you sent upstream was dependent on my accepting the ownership of this repo, which isn't happening. I am now working with the homebrew folks to clean this up and I don't appreciate being forced into it.

alanakos33 commented 4 months ago

I read the Readme.md in your repo and downloaded the mesloLG fonts you suggested from the links in the readme.

I later found that for some reason the icons in lazyvim (a neovim distribution, that needs nerdfonts to work) seem weird, some are too big, some are too small.

Downloading MesloLGS from nerdfonts fixed the issue for me in lazyvim (the icons became the same size as in the screenshots i saw and made more sense).

I also saw you applied some of your own changes to the font, i am assuming to make it play more nicely with powerlevel10k.

But there are a few problems:

  1. You don't mention anywhere in your Readme that you have modified the font from nerdfonts to make it more compatible with powerlevel10k, which in my case i spend a day trying to troubleshoot what's going on.

  2. The font name, doesn't include a variant suffix. When i do fc-list i don't see something like MesloLGS-NF-P10K i just see MesloLGS-NF, hence the confusion.

I suggest the following:

  1. Have a small note at the suggested fonts section, mentioning that the icons are resized to play better with P10K.

  2. When you modify the font with the script, add a suffix to the font-family like -P10K

romkatv commented 4 months ago

I haven't made any powerlevel10k-specific changes to the font. All changes that I've made are general improvements that benefit all users and all uses of the font equally.

alanakos33 commented 4 months ago

I haven't made any powerlevel10k-specific changes to the font. All changes that I've made are general improvements that benefit all users and all uses of the font equally.

The icons (for example the folder icon) from your font, are smaller than the MesloLG font from NerdFonts, also other icons are bigger than the NerdFonts (like some arrows).

Maybe they changed the upstream and you use an older version with different icon scaling?

They are clearly different in terms of icon sizes.

romkatv commented 4 months ago

I've changed the sizes of most icons. This was intentional. I think this makes the font better, and this improvement is not specific to powerlevel10k. Just better. For everything.

alanakos33 commented 4 months ago

I've changed the sizes of most icons. This was intentional. I think this makes the font better, and this improvement is not specific to powerlevel10k. Just better. For everything.

Ok maybe mention this at the Readme, at the suggested fonts section. I thought it would be identical to the NerdFont supplied MesloLGS, and took a bit of time to realize why my neovim icons looked bigger/smaller or just different from screenshots.

romkatv commented 4 months ago

You are the first person with this particular problem, so extra wording in the docs doesn't seem justifiable.

romkatv commented 4 months ago

This issue has been fixed: https://github.com/Homebrew/homebrew-cask-fonts/pull/9018

alanakos33 commented 4 months ago

You are the first person with this particular problem, so extra wording in the docs doesn't seem justifiable.

So you don't think you should mention that:

I've changed the sizes of most icons. This was intentional. I think this makes the font better, and this improvement is not specific to powerlevel10k. Just better. For everything.

Instead, you should let it be implied that you just offer a copy of the upstream NerdFonts, and a brief history, of who it has been modified by, except you.

It doesn't matter if i am the first or the last person to notice the difference, the comment on the suggested fonts is misleading, and can lead people, like it did for me to waste a couple of hours, thinking it must be something else besides the font. Until i finally tried the original out of luck, and saw that there the icon sizes are as advertised in various other github repos (for neovim, or other projects that use them).

Again, very misleading information, considering that the fonts are not used only by your shell theme, and tampering them might cause issues with other stuff.

Just keep the repo private man, if you can't even be clear about such a small thing.