gabrielelana / awesome-terminal-fonts

Tools and instructions on how to have awesome symbols in a terminal with a monospace font
MIT License
2.45k stars 230 forks source link

Applying font fallback on Mac OS X? #7

Closed andreafrancia closed 9 years ago

andreafrancia commented 9 years ago

I wish to use Pomicons on iTerm2 in Mac OS X.

If understood correctly I need to copy fonts from build to ~/Library/Fonts (instead of to ~/.fonts).

But I'm not sure where to put the 10-symbols.conf, provided that Mac OS X font system can understand this fontconfig file.

For now I'm working around this issue using the "Non-ASCII Font" fallback of iTerm2 but this is not a very good solution as you can add only just one font alternative.

I know about nothing about Fonts and how Fonts works on Mac OS X, and I'm also having some difficult in understand what to search on Google to find a solution, any help will be appreciated.

gabrielelana commented 9 years ago

I don’t think that the OS X font system works that way (I should specify in the README that the How to install section is specific to Linux freetype2)

Anyway, the magic words to search are ”OS X font fallback”, with that I found:

As far as I understood, you can configure the fallback fonts in the Plist located at /System/Library/Frameworks/ApplicationServices.framework/Frameworks/CoreText.framework/Resources/DefaultFontFallbacks.plist

With PlistBuddy you can also automate the procedure if you want

Be mind, I don’t know if this will work but hopefully it will, otherwise it could be a starting point :smile:

leoj3n commented 8 years ago

Install Fonts

Install the fonts from the ./build directory by double-clicking them in Finder.app:

image

You can organize them in a collection:

image

Disable System Integrity Protection

Reboot your mac and hold CMD+R after the startup chime.

Launch Terminal.app from the Utilities menu once booted into System Recovery and run:

csrutil disable; reboot

Edit Plist

Once rebooted back into normal mode, use Xcode.app to open and edit the plist file after first copying it to ~/Desktop:

cp /System/Library/Frameworks/ApplicationServices.framework/Frameworks/CoreText.framework/Resources/DefaultFontFallbacks.plist ~/Desktop
open -a Xcode.app ~/Desktop/DefaultFontFallbacks.plist

In the plist editor, expand "monospace" then click the + icon to add a new row and type in Pomodoro. Do this three more times for FontAwesome, Octicons, and Icomoon until the plist looks like:

image

Overwrite DefaultFontFallbacks.plist

Make a backup of the original DefaultFontFallbacks.plist:

cp /System/Library/Frameworks/ApplicationServices.framework/Frameworks/CoreText.framework/Resources/DefaultFontFallbacks.plist ~/DefaultFontFallbacks.plist.bak

Close Xcode.app and move the file back into place, overwriting the original:

sudo mv ~/Desktop/DefaultFontFallbacks.plist /System/Library/Frameworks/ApplicationServices.framework/Frameworks/CoreText.framework/Resources/DefaultFontFallbacks.plist

Re-Enable System Integrity Protection

Now reboot into recovery mode again (CMD+R) and re-enable System Integrity Protection:

csrutil enable; reboot

Works for me in iTerm2 Build 3.0.5 👍

oblitum commented 6 years ago

@leoj3n great, though, I must confess that is a painful process....