powerline / fonts

Patched fonts for Powerline users.
25.74k stars 3.19k forks source link

SF Mono Font #189

Open PhantomThief opened 8 years ago

PhantomThief commented 8 years ago

Patch SF Mono Font

which is available in XCode 8 beta 6

PatTheMav commented 7 years ago

Unfortunately patching it locally doesn't work with either the powerline font patcher nor with the one provided by the NerdFonts repository - the former doesn't add them properly, the latter adds much to small glyphs.

I'd be totally happy if any patcher could successfully add the glyphs to the SF Mono fonts, so people could patch their local versions at least.

abjugard commented 7 years ago

I highly doubt creating a patchset for a proprietary font would be illegal. Redistributing the font would be illegal, but that isn't what we're talking about here.

I would like this as well.

AnwarShah commented 7 years ago

@abjugard Licensing prevents modifying the fonts too as far as I know. That will be illegal

jdsimcoe commented 7 years ago

@PatTheMav I tried patching and am getting weird line-height display:

screen shot 2017-03-03 at 1 36 55 pm

Any ideas on how to fix this?

PatTheMav commented 7 years ago

@jdsimcoe I don't, unfortunately. I tried tinkering with some settings in the python script but I never got the patcher to get it right. I either had your issues or the glyphs themselves were much too small.

It seems as if Apple is doing some weird stuff with their glyphs and glyph sizes in their SF fonts that prohibits font forge from scaling the new glyphs correctly; then again I'm not a font expert, so..

jdsimcoe commented 7 years ago

@PatTheMav Got it 👍 Thanks for the color. It's a weird deal for sure. I found that the Nerd Fonts script got me closer but still not entirely there. It's a shame. SF Mono is a beautiful font.

PatTheMav commented 7 years ago

@jdsimcoe Absolutely, I use it as my default monospace font everywhere (it loses some lustre in non-macOS systems, especially windows - it seems to be fine-tuned for macOS' font rendering).

As I've switched to a very minimal prompt a while ago, I've only had to come up with alternatives for VIm, so I changed my powerline to use normal unicode glyphs instead.. ¯_(ツ)_/¯

jdsimcoe commented 7 years ago

That's cool @PatTheMav. I'd be curious to see code snippets of how you modified the powerline stuff.

xiaohk commented 7 years ago

@PatTheMav yeah, how do you change the powerline to "use normal unicode glyphs"? Can I do configure it with MacVim?

ZyX-I commented 7 years ago

@xiaohk You need to alter top theme: create ~/.config/powerline/config.json with {"common":{"default_top_theme":"unicode"}}. I personally use this variant with Vim only: {"ext":{"vim":{"top_theme":"unicode"}}}, shell and tmux are better with powerline symbols. There are more top themes: http://powerline.readthedocs.io/en/master/configuration/reference.html#themes.

PatTheMav commented 7 years ago

@xiaohk I'm not actually using Powerline, but Airline instead - Airline allows you to set the glyphs inside your .vimrc (also it's not depending on external interpreters).

xiaohk commented 7 years ago

@ZyX-I Thank you so much, it works perfectly! 👍🏼

jdsimcoe commented 7 years ago

@xiaohk Can you send instructions for exactly what you did.

xiaohk commented 7 years ago

@jdsimcoe Sure. I just did what ZyX-I says above. Create a config.json file in the powerline configure directory ~/.config/powerline/ (if you don't have it, just create one). Then add {"ext":{"vim":{"top_theme":"unicode"}}} into config.json. Set the font to SF Mono in $MYVIMRC (set guifont=SF\ Mono:h11). Relaunch your vim, and it should display the powerline properly.

desilinguist commented 7 years ago

@xiaohk @ZyX-I can this sort of thing be done for Terminal.app as well so SF Mono works there too?

jdsimcoe commented 7 years ago

I use Airline... @PatTheMav do you know how to get that config setup?

PatTheMav commented 7 years ago

Here's my current config (the Powerline glyphs don't appear of course):

if !exists('g:airline_symbols')
    let g:airline_symbols = {}
endif

let g:airline_powerline_fonts = 0
let g:airline_symbols.paste = 'ρ'
let g:airline_symbols.whitespace = 'Ξ'

if g:airline_powerline_fonts == 1
    let g:airline_left_sep = ''
    let g:airline_left_alt_sep = ''
    let g:airline_right_sep = ''
    let g:airline_right_alt_sep = ''
    let g:airline_symbols.branch = ''
    let g:airline_symbols.readonly = ''
    let g:airline_symbols.linenr = ''
else
    let g:airline_left_sep = ''
    let g:airline_left_alt_sep = ''
    let g:airline_right_sep = ''
    let g:airline_right_alt_sep = ''
    let g:airline_symbols.branch = '⎋'
    let g:airline_symbols.readonly = '✖︎'
    let g:airline_symbols.linenr = '␤'
end
jdsimcoe commented 7 years ago

Thanks for sharing!

ryanoasis commented 7 years ago

@PatTheMav I know it's been a while but you might have more success withe the latest version of the Nerd Fonts patcher script

Paul-van-Klaveren commented 6 years ago

For anyone interested, this SF Mono looks/works pretty ok for me: https://github.com/artofrawr/powerline-fonts/tree/master/fonts/SFMono (it's only Regular though—I'd rather use a Light version)

irrg commented 6 years ago

It's nice to have one, but it's kind of painful to see the blatant disregard for the binding license agreement SF Mono comes with…

PatTheMav commented 6 years ago

FWIW, I've patched SF Mono using the Nerdfont patcher and also added Ligatures with https://github.com/ToxicFrog/Ligaturizer to it. The font works and all glyphs are correctly sized when updated versions of both patchers are used.

For some time now macOS refuses to make the patched SF Mono variations available for font selection in my apps, alas I haven't found the reason yet so I can't say if it's connected in any way.

jdsimcoe commented 6 years ago

@PatTheMav do you have a version for download somewhere?

PatTheMav commented 6 years ago

@jdsimcoe As @irrg correctly mentioned before, redistribution is prohibited by the font's license and I personally like to honor license agreements.

(We can't get all fussy about corporations violating e.g. GPL licenses but show wanton disregard for other licenses for that matter).

jdsimcoe commented 6 years ago

Cool @PatTheMav I will re-try the scripts then.

jdsimcoe commented 6 years ago

@PatTheMav what settings did you use when you did the Nerdfont patcher?

PatTheMav commented 6 years ago

@jdsimcoe I don't think I did anything fancy - selected to have the Powerline glyphs added only and let the patcher do its thing.

I don't remember which commit fixed the issues I had with regards to sizing, but it just "worked" - followed this guide: https://github.com/ryanoasis/nerd-fonts#font-patcher

jdsimcoe commented 6 years ago

Cool @PatTheMav --- that worked!

deg0nz commented 6 years ago

@PatTheMav Thanks a lot! It works :)

cixtor commented 6 years ago

The instructions from @PatTheMav indeed worked.

Original SFMono fonts are in /Applications/Utilities/Terminal.app/Contents/Resources/Fonts/

  1. Download nerd-fonts (3.7GB) anywhere in your computer,
  2. Extract the content of the Zip archive and cd into that directory
  3. Execute ./font-patcher -q --powerline /path/to/the/SFMono-Regular.otf
  4. Either open the generated OTF file or move it to ~/Library/Fonts/SFMono-Regular.otf
  5. In your Terminal window, open "Preferences > Profiles > Text > Font"
  6. It seems to work better at 12pt, but that's a personal choice
  7. Search for "SFMono Nerd Font" in the font book browser
  8. ???
  9. Profit

I suggest to patch the "Bold" version too if you want support for bold text in the Terminal.

floam commented 5 years ago

Protip, use the SF Mono OTFs that come with Xcode, not Terminal. They are in /Applications/Xcode.app/Contents/SharedFrameworks/DVTKit.framework/Versions/A/Resources/Fonts/.

It's a newer version of the font: "13.1d0e10; 2017-08-09", compared to the original it has a few tweaked glyphs and a couple dozen added glyphs.

joshuat commented 4 years ago

The Xcode OTFs are now located at /Applications/Xcode.app/Contents/SharedFrameworks/DVTUserInterfaceKit.framework/Versions/A/Resources/Fonts/.