Updates on font changes in Snow Leopard

A few months ago, I’ve covered font related changes in Snow Leopard in [this post](http://blog.jjgod.org/2009/03/17/snow-leopard-font-related-changes/), that was perceived from developer preview build 10A286, after I got build 10A335 and 10A354, several changes can be observed.

1. Heiti SC and Heiti TC we covered earlier are now used as the default fallback fonts for Simplified Chinese and Traditional Chinese, respectively. We can see this via the content of the default font fallback configuration file of [Core Text](http://en.wikipedia.org/wiki/Core_Text):

$ cat /System/Library/Frameworks/ApplicationServices.framework/\
Frameworks/CoreText.framework/Resources/DefaultFontFallbacks.plist



zh-Hant
STHeitiTC-Light



zh-Hans
STHeitiSC-Light

2. “**Menlo**”, the monospaced font we mentioned previously, are apparently used as the default coding font for Xcode 3.2 now. Apple even filed a couple of trademark registrations in [US](http://tarr.uspto.gov/tarr?regser=serial&entry=77-745991+&action=Request+Status) and [EU](http://www.macnn.com/blogs/2009/06/01/823.html) for that name.

Menlo
Menlo Regular in Xcode 3.2

Personally, I still prefer the good-old-Monaco.

3. A pair of new Chinese OpenType fonts called **Hiragino Sans GB** and **Hiragino Sans CNS** have been added into recent builds, for Simplified Chinese and Traditional Chinese, respectively. Both fonts have two widths: W3 and W6.

Hiragino Sans GB W3
Hiragino Sans GB W3
Hiragino Sans GB W6
Hiragino Sans GB W6
Hiragino Sans GB W3
Hiragino Sans GB W3

These fonts were [announced](http://www.screen.co.jp/ga_product/sento/press/MP_NL081118E.pdf) by Dainippon Screen Mfg. Co., Ltd., they are specifically designed for Chinese users, but in a traditional Japanese Kanji style. These fonts can be seen as “sans-serif” fonts (hence the name) or “Gothic” fonts in Japanese term, or “heiti” in Chinese term.

However, Hiragino Sans CNS, the font family for traditional Chinese appeared in 10A335 is removed suspiciously in 10A354. I wonder if Apple will added it back in the official release.

For comparision, Microsoft licensed a pair of Chinese fonts called “[Microsoft Yahei](http://en.wikipedia.org/wiki/Microsoft_YaHei)” and “[Microsoft Jhenghei](http://www.microsoft.com/typography/fonts/family.aspx?FID=368)” in Windows Vista, which are somewhat similar to Hiragino Sans fonts, at least to my eyes.

dump 混合光盘镜像中的 ISO 9660 分区

Leopard / Snow Leopard 光盘镜像是混合 (hybrid) 分区格式,也就是一个磁盘镜像中,既有 HFS+ 分区,也有 ISO 9660 分区 (Boot Camp 驱动就存放在这个分区上),在 Mac OS X 上只会挂载前者,在 Windows 下只会挂载后者。虽然可以在 Terminal 下手工挂载后者,但也不是很方便,这里记录一个脚本,方便直接把 ISO 9660 分区 dump 为 ISO 文件:

$ cat dump.sh
#!/usr/bin/env bash
DISK=`hdiutil attach -noverify $1 | awk ‘/Apple_partition_scheme/ { print $1 }’`
dd if=$DISK of=$2 bs=512 count=`hdiutil pmap $DISK | awk ‘/WINDOWSSUPPORT/ { print $6 }’`
hdiutil detach $DISK

使用方法:

$ ./dump.sh snowleopard_10a354_userdvd.dmg bc.iso

Palm Pre 中的默认字体

Coconut Medium
Coconut Medium

最显眼的,也是整个 Palm Pre 产品的标志性字体,是英文用的 Coconut 字体族,这是一套由 [The Font Bureau](http://www.fontbureau.com/) 在 2008 年给 Palm 专门开发的 sans-serif 字体,包含 Medium, Medium Oblique, Condensed Bold, Condensed Medium, Bold, Bold Oblique 六种风格。这套字体看起来很像修改版的 [Avenir](http://www.fontshop.com/fonts/downloads/linotype/avenir_std_complete_vp/)。

更新:The Font Bureau [正式发布](http://typophile.com/node/58935)了这款字体,命名为 Prelude,可能是因为先前已经有字体叫作 Coconut 了…

日文是 [VL PGothic Regular](http://sourceforge.jp/projects/vlgothic/),看得出是经过精心选择的免费字体。

简体/繁体中文是[文鼎 PL UMing](http://packages.debian.org/sid/ttf-arphic-uming) (AR PL UMing),这个就比较恶了,可惜能选的免费字体也不多。

韩文是 Batang,这个应该是 Windows 下默认的韩文字体。

还提供了 Times New Roman, Arial, Verdana, Courier New 和 Lucida Console 这几套 PC 上常见的字体。

值得一提的是,还有原来 Palm OS 上经典的点阵字体 [Sunnyvale](http://www.myfonts.com/WhatTheFont/forum/viewthread.php?threadid=178956)。

Packaging for Installation on Mac OS X

在 Mac OS X 下为程序打包该用什么格式?这是个很有趣的问题,首先,显然绝大部分的应用程序都应该:

* 使用手动安装,也就是一个独立的 `.app`,里面通过 `@executable_path/../Frameworks/` 的方式[链接所有依赖的第三方库](http://www.cocoadevcentral.com/articles/000042.php),也就是说,不往系统相关目录里乱放东西。这是 Apple 官方的 Software Delivery Guide 中[推荐的安装方式](http://developer.apple.com/documentation/DeveloperTools/Conceptual/SoftwareDistribution/Introduction/Introduction.html)。
* 支持用 Sparkle 这样的自动更新框架,实际上符合上一点的也就自然可以用 Sparkle 完全自动的完成更新。
* 用 `.zip` 格式分发。为什么不用 `.dmg`?因为 `.dmg` 不容易直接解压,挂载速度比 `.zip` 慢得多,增加拖动的手续,所以我支持这篇 [zip vs dmg](http://0xced.blogspot.com/2006/11/zip-vs-dmg.html) 的观点。

SunPinyin 安装界面

但是如果遇到特殊的情况呢?比如你写的是一个**非得**往系统目录 (`/Library/…`) 安装内容的软件呢?比如我最近参与改进的 [SunPinyin 输入法](http://blogs.sun.com/yongsun/entry/sunpinyin_for_mac_leopard_updated6),就必须打包为 Installer 支持的 `.pkg` 格式安装了,否则很难确保软件被正确的安装。

关于这个打包方式,最重要的一点心得是:千万不要用 Apple 自己提供的 [PackageMaker](http://developer.apple.com/DOCUMENTATION/DeveloperTools/Conceptual/PackageMakerUserGuide/index.html),这恐怕是 Apple 开发的最恐怖的一个开发辅助工具了,因为:

* 它必须用图形界面修改内容
* 它保存的 `.pmdoc` 格式非常混乱,而且居然喜欢把*绝对路径*存入文件中
* 不支持 [Installer Plugins](http://developer.apple.com/samplecode/InstallerPluginSample/listing1.html) 扩展

那替代的工具是什么呢?是一个非常棒的第三方工具: [Iceberg](http://s.sudre.free.fr/Software/Iceberg.html),它能:

* 打包出 Mac OS X 10.2+ 以上都支持的 `.pkg` bundle 格式
* 界面比 PackageMaker 友好得多,而且有非常详尽的文档,也很方便调试
* 支持 Installer Plugin

涉及打包、Sparkle 的 appcast 自动生成,Iceberg 的使用等问题,都可以参考 SunPinyin [目前使用的代码](http://src.opensolaris.org/source/xref/nv-g11n/inputmethod/sunpinyin/ime/wrapper/macos/packaging/)。

Web 字体的出路在哪里?

浏览器直接可用的 Web 字体在去年被重新提起,可是没过一段时间就沉寂下去,最近一期 [A List Apart](http://www.alistapart.com/) 上 Jeffrey Zeldman 采访 David Berlow 的这篇 [Real Fonts on the Web](http://www.alistapart.com/articles/realfontsontheweb) 又引起了新一轮的讨论,这里摘录一些有趣的话。

David Berlow:
> How important dynamically rendered type is to design and use on the web must now be clear. In addition, the only other option—that the type industry cede its intellectual property to the public without permission—is not going to happen.

[Tal Leming](http://talleming.com/2009/04/21/web-fonts/):
> There should be a new file extension for this. I propose “.wtf” – “WebType Font”.

[Mark Pilgrim](http://diveintomark.org/archives/2009/04/21/fuck-the-foundries):
> … What he fails to mention is that *every font-consuming application on every platform on every computer on Earth* will need to be “upgraded” to “respect” this permissions table. Because otherwise they’re not really permissions, are they? They’re just useless bits taking valuable chunks out of my metered bandwidth plan. Like the [bozo bit](http://en.wikipedia.org/wiki/Bozo_bit) without the bozo.

[Jonathan Hoefler](http://www.typography.com/):
> All of the type designers I know desperately want to find a way to enable people to use fonts online, and not just because we’re capitalist stooges, but because we live our lives online.

[Bruce Schneier](http://www.schneier.com/crypto-gram-0108.html#7):
> Truth be told, I don’t know. I feel rather like the physicist who just explained relativity to a group of would-be interstellar travelers, only to be asked: ‘How do you expect us to get to the stars, then?’ I’m sorry, but I don’t know that, either.

总结起来,未来还是很黑暗。