Created
November 29, 2010 15:53
-
-
Save nuex/720115 to your computer and use it in GitHub Desktop.
Imports OSX fonts from a zip file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# Synopsis: | |
# Sometimes I have to use MACOSX fonts on my Linux machine. | |
# They come in from a zip file, but the fonts are hidden files | |
# in a __MACOSX directory in the zip. This script handles | |
# unzipping the file, moving the hidden font files into my user | |
# font directory and updating my font cache automatically. | |
# | |
# Description: | |
# Imports OSX fonts from a zip file | |
# | |
# Usage: | |
# import_osxfnt.sh osxfont.zip | |
# | |
ZIP=$1 | |
filename=`basename $ZIP` | |
base=${filename%.*} | |
tmpdir=/tmp/_osxfnts/$base | |
SAVEIFS=$IFS | |
# Change IFS to support spaces | |
IFS=`echo -en "\n\b"` | |
mkdir -p $tmpdir | |
cp $ZIP $tmpdir | |
cd $tmpdir | |
unzip $ZIP | |
cd __MACOSX | |
# Iterate through each directory, moving the OSX hidden font files | |
# to the current user's font directory | |
for d in *; do | |
cd $d | |
for i in ._*; do | |
mv $i ~/.fonts/`echo $i | sed 's/\._//g'` | |
done | |
done | |
rm -rf $tmpdir | |
# Update font cache | |
fc-cache |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment