转载

[iOS] [英] YosemiteAndElCapitanSystemFontPatcher - OS X 平台的字体切换工具

Yosemite and El Capitan System Font Patcher

Change the system font of Mac OS X Yosemite and El Capitan. Inspired by FiraSystemFontReplacement .

Maybe it's just me, but for such a new and modern interface, Helvetica Neue feels… ancient , and Helvetica is already everywhere… A more futuristic font such as Avenir Next may be a better choice.

[iOS] [英] YosemiteAndElCapitanSystemFontPatcher - OS X 平台的字体切换工具

Project Status: Help Wanted

The software provided here works for me, and I get the Avenir Next font I wanted. You can also use this software to patch fonts for your own use as well. However, there are few minor issues, such asfont baseline issue. I'd like some help from the community to resolve these, especially font experts.

New: Step by Step Tutorial (Yosemite Only)

Note:The convenient script and step by step tutorial currently only works for Yosemite. Contributions to help update this to also work with El Capitan would be much appreciated.

Prerequisites

Using Homebrew (easy!)

Note: This method doesn't seem to work anymore on Yosemite 10.10.3 . You can tryinstalling using MacPorts(seethe discussion) or if you don't like MacPorts, try running YosemiteSystemFontPatcher inside a Linux box .

First, install Homebrew and XQuartz . Then install FontForge with Python support.

brew install fontforge --with-python

Make sure FontForge works in Python:

python -c 'import fontforge; print "FontForge works in Python"'

Using MacPorts (for those who prefer)

Instructions provided by @AluminumPea. After installing MacPorts, install Fontforge with Python 2.7 support and switch to that Python. Make sure that you are not using Homebrew's Python!

sudo port install fontforge +python27 sudo port select --set python python27

New: Convenient Script (Yosemite Only)

Note:The convenient script and step by step tutorial currently only works for Yosemite. Contributions to help update this to also work with El Capitan would be much appreciated.

A convenient script is provided for you to convert fonts using a GUI wizard. In your Terminal, cd to the project folder and run:

bin/convenient-script

Patching a Font (Manual)

Copy HelveticaNeueDeskInterface.ttc from /System/Library/Fonts/ to the root of the repository. Then run the following command:

bin/patch 'System Font Name' 'Font To Use'

Where System Font Name is*:

System Font Name* Description
System Font Regular Regular :star:
System Font Bold Bold :star:
System Font Italic Italic
System Font Bold Italic Bold
System Font Medium P4 Medium - used in notification title :star:
System Font Medium Italic P4 Medium Italic
システムフォント レギュラ ライト Light
System Font Thin Thin
System Font UltraLight Ultra Light
System Font Heavy Heavy

(* note: the above table is for English locale. For other locales, you must check the list of system font names by running bin/list-fonts HelveticaNeueDeskInterface.ttc — see issue#1)

...and Font To Use is the path to the font file you want to use. For example, Raleway-Medium.ttf .

Some fonts come in .ttc file format, which contains many fonts in one file. For instructions to use them, see below.

The font names that I did not put a star on are rarely used; you don't have to patch it.

The script will

  • open the font file to use,
  • scale and adjust the metrics to match that of the system font (that's why the script needs HelveticaNeueDeskInterface.ttc to be present),
  • adjust the PostScript name to match with the system font, and
  • save the font into current directory.

Specifying a .ttc File

A .ttc file contains several fonts in one file. Most fonts that comes with OS X come in this format. To select a font inside .ttc file, put the font name inside the parentheses . For example, Avenir Next.ttc(Avenir Next Medium) .

Installation

Simply copy the generated font files to /Library/Fonts . Mac OS X will use these fonts instead of the system fonts.

Examples

El Capitan

The following Bash script converts Avenir Next into a system font usable with El Capitan.

patch-system-font() {   BASE="$1"   REPLACEMENT="$2"   ./bin/patch "/System/Library/Fonts/$BASE" "/System/Library/Fonts/$REPLACEMENT" }  patch-system-font 'SFNSDisplay-Black.otf' 'Avenir Next.ttc(Avenir Next Heavy)' patch-system-font 'SFNSDisplay-Bold.otf' 'Avenir Next.ttc(Avenir Next Bold)' patch-system-font 'SFNSDisplay-Heavy.otf' 'Avenir Next.ttc(Avenir Next Heavy)' patch-system-font 'SFNSDisplay-Light.otf' 'Avenir Next.ttc(Avenir Next Regular)' patch-system-font 'SFNSDisplay-Medium.otf' 'Avenir Next.ttc(Avenir Next Medium)' patch-system-font 'SFNSDisplay-Regular.otf' 'Avenir Next.ttc(Avenir Next Medium)' patch-system-font 'SFNSDisplay-Semibold.otf' 'Avenir Next.ttc(Avenir Next Demi Bold)' patch-system-font 'SFNSDisplay-Thin.otf' 'Avenir Next.ttc(AvenirNext-UltraLight)' patch-system-font 'SFNSDisplay-Ultralight.otf' 'Avenir Next.ttc(AvenirNext-UltraLight)' patch-system-font 'SFNSText-Bold.otf' 'Avenir Next.ttc(Avenir Next Bold)' patch-system-font 'SFNSText-BoldG1.otf' 'Avenir Next.ttc(Avenir Next Bold)' patch-system-font 'SFNSText-BoldG2.otf' 'Avenir Next.ttc(Avenir Next Bold)' patch-system-font 'SFNSText-BoldG3.otf' 'Avenir Next.ttc(Avenir Next Bold)' patch-system-font 'SFNSText-BoldItalic.otf' 'Avenir Next.ttc(Avenir Next Bold Italic)' patch-system-font 'SFNSText-BoldItalicG1.otf' 'Avenir Next.ttc(Avenir Next Bold Italic)' patch-system-font 'SFNSText-BoldItalicG2.otf' 'Avenir Next.ttc(Avenir Next Bold Italic)' patch-system-font 'SFNSText-BoldItalicG3.otf' 'Avenir Next.ttc(Avenir Next Bold Italic)' patch-system-font 'SFNSText-Heavy.otf' 'Avenir Next.ttc(Avenir Next Heavy)' patch-system-font 'SFNSText-HeavyItalic.otf' 'Avenir Next.ttc(Avenir Next Heavy Italic)' patch-system-font 'SFNSText-Light.otf' 'Avenir Next.ttc(Avenir Next Regular)' patch-system-font 'SFNSText-LightItalic.otf' 'Avenir Next.ttc(Avenir Next Italic)' patch-system-font 'SFNSText-Medium.otf' 'Avenir Next.ttc(Avenir Next Demi Bold)' patch-system-font 'SFNSText-MediumItalic.otf' 'Avenir Next.ttc(Avenir Next Demi Bold Italic)' patch-system-font 'SFNSText-Regular.otf' 'Avenir Next.ttc(Avenir Next Medium)' patch-system-font 'SFNSText-RegularG1.otf' 'Avenir Next.ttc(Avenir Next Medium)' patch-system-font 'SFNSText-RegularG2.otf' 'Avenir Next.ttc(Avenir Next Medium)' patch-system-font 'SFNSText-RegularG3.otf' 'Avenir Next.ttc(Avenir Next Medium)' patch-system-font 'SFNSText-RegularItalic.otf' 'Avenir Next.ttc(Avenir Next Medium Italic)' patch-system-font 'SFNSText-RegularItalicG1.otf' 'Avenir Next.ttc(Avenir Next Medium Italic)' patch-system-font 'SFNSText-RegularItalicG2.otf' 'Avenir Next.ttc(Avenir Next Medium Italic)' patch-system-font 'SFNSText-RegularItalicG3.otf' 'Avenir Next.ttc(Avenir Next Medium Italic)' patch-system-font 'SFNSText-Semibold.otf' 'Avenir Next.ttc(Avenir Next Demi Bold)' patch-system-font 'SFNSText-SemiboldItalic.otf' 'Avenir Next.ttc(Avenir Next Demi Bold Italic)'

After running this script, copy the resulting font files to /Library/Fonts .

Yosemite

To make Avenir Next your system font, copy Avenir Next.ttc from /System/Library/Fonts into the repository root, and then use this script:

#!/bin/bash -e bin/patch 'System Font Regular'            'Avenir Next.ttc(Avenir Next Medium)' bin/patch 'System Font Bold'               'Avenir Next.ttc(Avenir Next Bold)' bin/patch 'System Font Italic'             'Avenir Next.ttc(Avenir Next Medium Italic)' bin/patch 'System Font Bold Italic'        'Avenir Next.ttc(Avenir Next Bold Italic)' bin/patch 'System Font Medium P4'          'Avenir Next.ttc(Avenir Next Demi Bold)' bin/patch 'System Font Medium Italic P4'   'Avenir Next.ttc(Avenir Next Demi Bold Italic)'

It generates:

  • System Avenir Next Bold Italic.ttf
  • System Avenir Next Bold.ttf
  • System Avenir Next Demi Bold Italic.ttf
  • System Avenir Next Demi Bold.ttf
  • System Avenir Next Medium Italic.ttf
  • System Avenir Next Medium.ttf

Now you can copy these files into /Library/Fonts , log out, and log back in. You should see the font changed!

Thanks

I consulted these resources in creating the script:

  • jenskutilek/FiraSystemFontReplacement
  • Lokaltog/powerline-fontpatcher
  • Design With FontForge: Line Spacing
  • Writing python scripts to change fonts in FontForge
  • kawabata/hanamin-kdp - makefont.py

Disclaimer

  • This software has been provided AS-IS. Use at your own risk.
  • I provide this software for people to patch fonts for their own use. I don't support redistributing patched licensed fonts.
原文  https://github.com/dtinth/YosemiteAndElCapitanSystemFontPatcher
正文到此结束
Loading...