Skip to content

Instantly share code, notes, and snippets.

@netj
Created October 5, 2011 21:40
Show Gist options
  • Save netj/1265826 to your computer and use it in GitHub Desktop.
Save netj/1265826 to your computer and use it in GitHub Desktop.
iOS Font Modifier -- 한글 글꼴 교체된 iOS ipsw 제작 도구
.DS_Store
.*.sw?
/*,*_*_*.dmg
/Hamchorom-LVT.zip*
/HCRDotum.bundle/files/*

iOS Font Modifier

This tool helps you generate a PwnageTool custom bundle that will replace your Korean fonts in it.

  1. Run the following command from this directory:

    ./update-HCRDotum.bundle.sh ~/Library/iTunes/iPhone\ Software\ Updates/iPhone2\,1_4.3.5_8L1_Restore.ipsw
    

    You should replace the argument with your version of ipsw.

  2. Run ./install.sh to inject the bundle into PwnageTool.app

  3. Launch PwnageTool.app to build your custom ipsw. You can remove CydiaInstaller bundle if you want your ipsw to be clean and not jailbreaked.

  4. You will need redsn0w or other tools that can exploit the bootloader that allow you to install custom ipsw on your device. If you decided not to use Cydia when creating the ipsw, then you can get exactly the same iOS on your device with only a small number of files modified, e.g. default fonts.

Acknowledgement & Disclaimer

You can get PwnageTool from iPhone Dev-Team. Hamchorom font is provided by HANCOM for free individual use, and Hamchorom-LVT is an enhanced version of it by KTUG. VFDecrypt is a nice tool built by someone else.

This is free and unencumbered software released into the public domain.

Enjoy!

~netj

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Name</key>
<string>함초롬 돋움 글꼴</string>
<key>Identifier</key>
<string>org.mazic.betterfonts.ko.hcrdotum</string>
<key>Description</key>
<string>AppleGothic을 함초롬 글꼴로 교체합니다. 한글 굵은 글씨가 올바르게 표시됩니다.</string>
<key>SupportedFirmware</key>
<array>
<string>iPhone2,1_4.3.5_8L1</string>
<string>iPhone3,1_4.3.3_8J2</string>
<string>iPad1,1_4.3.3_8J3</string>
<string>iPod3,1_4.3.3_8J2</string>
<string>iPod4,1_4.3.3_8J2</string>
</array>
<key>Size</key>
<integer>27737024</integer>
</dict>
</plist>
#!/usr/bin/env bash
set -eu
pwnagetool=/Applications/PwnageTool.app
cp -av *.bundle $pwnagetool/Contents/Resources/CustomPackages/
#!/usr/bin/env bash
# A script for making HCRDotum.bundle for PwnageTool up-to-date
# Usage: update-HCRDotum.bundle.sh "iPhone Software Updates"/*.ipsw
#
# Author: Jaeho Shin <netj@sparcs.org>
# Created: 2011-05-07
set -eu
bundle=HCRDotum.bundle
path=System/Library/Fonts/Cache
[ $# -eq 1 ] || { sed -n '2,/^#$/ s/^# //p' <"$0"; exit 1; }
ipsw=$1; shift
name=`basename "$ipsw"`
name=${name%_Restore.ipsw}
device=${name%%_*}
version=$name
version=${version#${device}_}
mkdir -p "$bundle/files/$path"
# first, download fonts (HCRDotum)
LocalName=Hamchorom-LVT.zip
URL=http://ftp.ktug.or.kr/KTUG/hcr-lvt/Hamchorom-LVT.zip
echo "Downloading $LocalName"
completeFlag="$LocalName.complete"
if [ -e "$completeFlag" ]; then
# avoid downloading twice if we have a complete one
rm -f "$completeFlag"
curl -L -Rz "$LocalName" -o "$LocalName" "$URL" || curl -L -R -o "$LocalName" "$URL"
else
# otherwise, try resuming the previous one
curl -L -R -C - -o "$LocalName" "$URL" || curl -L -R -o "$LocalName" "$URL"
fi
touch "$completeFlag"
echo "Extracting Fonts from $LocalName"
unzip -o "$LocalName" HANDotum*
mv -f HANDotum-LVT.ttf "$bundle/files/$path"/AppleGothic.ttf
mv -f HANDotumB-LVT.ttf "$bundle/files/$path"/AppleGothicBold.ttf
#read -p "Please mount the root filesystem of the ipsw and press Enter..."
dmg_decrypted="${device}_$version".dmg
if [ -f "$dmg_decrypted" ]; then
echo "Using $dmg_decrypted"
else
echo "Extracting $dmg_decrypted from ipsw"
tmp=`mktemp -d /tmp/PwnageToolBundleGenerator.XXXXXX`
trap "rm -rf $tmp" EXIT
# extract ipsw
echo "Extracting ipsw"
unzip "$ipsw" -d $tmp
dmg=`ls -S $tmp/*.dmg | head -n 1`
# decrypt root fs
dmgname=`basename $dmg`
build=${version#*_}
echo "Consult http://theiphonewiki.com/wiki/index.php?search=$dmgname+$build"
read -p "And enter the found VFDecrypt Key for $dmgname:" key
./vfdecrypt -i $dmg -k "$key" -o "$dmg_decrypted"
fi
# attach the root fs image and import contents from it
root=(/Volumes/*.N88OS)
if [ ! -d "$root" ]; then
hdiutil attach "$dmg_decrypted"
root=(/Volumes/*.N88OS)
fi
echo "Importing original files from $root"
rm -f "$bundle/files/$path"/../*.plist
find "$root/$path"/../*.plist -type f -exec cp -av {} "$bundle/files/$path"/../ \;
# Update plists
(
cd "$bundle"
for p in "files/$path"/../*.plist; do
echo "Updating $p"
plutil -convert xml1 "$p"
vim +'%s/\(Bold.*\n.*AppleGothic\)</\1 Bold</g' +wq "$p"
vim +1 +'/>AppleGothic Regular<' +'norm 2yyjp' +'norm fRceBold' +'norm jf.iBold' +wq "$p"
plutil -convert binary1 "$p"
done
)
# Adjust Info.plist
# SupportedFirmware
vim +'%s:\(<string>'"$device"'_\)\d\+\(\.\d\+\)\+_\w\+\(</string>\):\1'"$version"'\3:g' +wq "$bundle"/Info.plist
echo "Updating Info.plist: SupportedFirmware ${device}_$version"
# Size
size=$(bc <<<"`stat -c %s "$bundle/files/$path"/* | tr '\n' '+'` -`stat -c %s "$root/$path"/AppleGothic.ttf`")
echo "Updating Info.plist: Size=$size"
vim +'%s/\(Size.*\n.*integer>\)\d\+</\1'"$size"'</g' +wq "$bundle"/Info.plist
# clean up
hdiutil detach "$root"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment