Snow Leopard 在字体方面的变化

1. 字体反锯齿选项不再允许选择 hinting 的程度 (以前可以选择 Medium, Light, etc.),现在似乎默认就是 Medium,不能改,很奇怪 (我个人习惯用 Light 的)。

System Preferences -> Appearance

2. 原来 Mac OS 独有的 dfont 字体格式被抛弃了,改用 [ttc](http://en.wikipedia.org/wiki/True_Type_Font#TrueType_Collection) (TrueType Collection) 格式替代。

uncia:~ jjgod$ ls /Library/Fonts/*.ttc
/Library/Fonts/AmericanTypewriter.ttc /Library/Fonts/GillSans.ttc
/Library/Fonts/Baskerville.ttc /Library/Fonts/HelveticaCY.ttc
/Library/Fonts/Chalkboard.ttc /Library/Fonts/Hoefler Text.ttc
/Library/Fonts/Cochin.ttc /Library/Fonts/MarkerFelt.ttc
/Library/Fonts/Copperplate.ttc /Library/Fonts/Optima.ttc
/Library/Fonts/Didot.ttc /Library/Fonts/Papyrus.ttc
/Library/Fonts/Futura.ttc /Library/Fonts/STHeiti Medium.ttc

uncia:~ jjgod$ ls /System/Library/Fonts/*.ttc
/System/Library/Fonts/Courier.ttc /System/Library/Fonts/Menlo.ttc
/System/Library/Fonts/Helvetica.ttc /System/Library/Fonts/STHeiti Light.ttc
/System/Library/Fonts/HelveticaNeue.ttc /System/Library/Fonts/Times.ttc
/System/Library/Fonts/LucidaGrande.ttc

3. iPhone OS 中使用的混合简繁中日韩语言版本的 (华文) 黑体出现在 Snow Leopard 中,一个 `/System/Library/Fonts/STHeiti Light.ttc` 文件对应了 Heiti SC, Heiti TC, Heiti J 和 Heiti K 这四套字体。

Heiti Fonts

4. 新增修改自 [Bitstream Vera Sans Mono](http://www.bitstream.com/font_rendering/products/dev_fonts/vera.html) 的新等宽字体 Menlo (这个名字大概是来自 [Menlo Park](http://is.gd/nDN8)),提供 Regular, Italic, Bold, Bold Italic 四种风格。

Menlo Regular

Menlo Regular Info

因为授权比较自由,这个字体恐怕是软件发行者最受欢迎的等宽字体,之前 [Panic Coda](http://www.panic.com/coda/), [BBEdit](http://www.barebones.com/products/bbedit/) 和 [MacVim](http://code.google.com/p/macvim/) 都提供了各自的修改版本。

用 AppleScript 来辅助 Pages 排版

[Pages](http://www.apple.com/iwork/pages/) 的混合语言排版功能一直为人诟病 (实际上 Pages 的多语言支持也一直很弱,甚至比不上 TextEdit),比如像组合字体 (combined font) 这样在排版软件中很常见的功能也迟迟没有提供,所以经常有人说用 Pages 排版中英文混合的文章是一种折磨。

昨天看到 Apple 版上的一篇文章,便想起来试试 Page ’09 新增的 AppleScript 功能,其实用到的功能在之前的 Pages 版本中应该也有,不过我手头没有更早的版本,所以无法试验了。可以点这里看[完整的脚本](http://att.newsmth.net/att.php?s.719.285617.1216.py),其实核心代码非常短:

from appscript import *
pages = app(id=”com.apple.iWork.Pages”)

for doc in pages.documents():
words = doc.words()
i = 0

for word in words:
i += 1
if isch(word[0][0]):
doc.words[i].font_name.set(“SimSun”)

这个脚本没有直接用 AppleScript,而是通过第三方提供的 [py-appscript](http://appscript.sourceforge.net/) 接口来调用 (它的语法比 [ScriptingBridge](http://www.apple.com/applescript/features/scriptingbridge.html) 要友好很多),作用是,扫描所有 Pages 打开的文档,把所有的汉字的字体设为 SimSun,因为仅仅作为一个示例,所以没有加任何参数。

使用方法是,先[安装 py-appscript](http://appscript.sourceforge.net/py-appscript/install.html),然后打开 Pages,随便输入一段中文和英文混杂的文字,比如刚才的“在50ml的PBS缓冲中加入15mg的HCl使得最终pH为5”这句,一开始加入时因为默认字体是 Helvetica,所以英文字母和数字都用了 Helvetica,汉字则使用了 Helvetica 的默认 Fallback, 也就是 STXihei,如下图所示。

before

然后运行:

python format-pages.py

这时候切换回 Pages 就能看到效果,如下图所示。

after

其实这个脚本还可以做很多其他的变化,比如加入界面来选择字体、只是转换当前选中的部分等等等等,至少了解一点 AppleScript 的调用方式就可以尝试,这里不赘述了。

A closer look at Classics.app

A Screenshot of Classics

“[Classics](http://www.classicsapp.com/)” is a great product, it shows us iPhone developers what an *elegant* ebook reader can be, so I bought it almost instantly after it’s released. I’ve been chatting with my friends about this app for a while, now I’d like to give a more closer examination to it from the perspective of a typographer and a programmer. Especially its weaknesses.

Illustrated by my favorite graphic designer, [David Lanham](http://dlanham.com), Classics tries its best to provide a traditional book reading experience (that’s why it’s called “Classics”). It contains the following books, even I’ve read most of them in Chinese long time ago, thanks to Classics, it’s still a fascinating experience to read them again in English:

* *[20,000 Leagues Under the Sea](http://en.wikipedia.org/wiki/Twenty_Thousand_Leagues_Under_the_Sea)* by [Jules Verne](http://en.wikipedia.org/wiki/Jules_Verne)
* *[A Christmas Carol](http://en.wikipedia.org/wiki/A_Christmas_Carol)* by [Charles Dickens](http://en.wikipedia.org/wiki/Charles_Dickens) [Added in version 1.1]
* *[Alice in Wonderland](http://en.wikipedia.org/wiki/Alice_in_Wonderland)* by [Lewis Carroll](http://en.wikipedia.org/wiki/Lewis_Carroll)
* *[Flatland](http://en.wikipedia.org/wiki/Flatland)* by [Edwin Abbott Abbott](http://en.wikipedia.org/wiki/Edwin_Abbott_Abbott)
* *[Gulliver’s Travels](http://en.wikipedia.org/wiki/Gulliver%27s_Travels)* by [Jonathan Swift](http://en.wikipedia.org/wiki/Jonathan_Swift)
* *[The Hound of the Baskervilles](http://en.wikipedia.org/wiki/Hound_of_the_Baskervilles)* by Sir [Arthur Conan Doyle](http://en.wikipedia.org/wiki/Arthur_Conan_Doyle)
* *[Adventures of Huckleberry Finn](http://en.wikipedia.org/wiki/Adventures_of_Huckleberry_Finn)* by [Mark Twain](http://en.wikipedia.org/wiki/Mark_Twain)
* *[Paradise Lost](http://en.wikipedia.org/wiki/Paradise_Lost)* by [John Milton](http://en.wikipedia.org/wiki/John_Milton)
* *[Robinson Crusoe](http://en.wikipedia.org/wiki/Robinson_Crusoe)* by [Daniel Defoe](http://en.wikipedia.org/wiki/Daniel_Defoe)
* *[The Call of the Wild](http://en.wikipedia.org/wiki/The_Call_Of_The_Wild)* by [Jack London](http://en.wikipedia.org/wiki/Jack_London)
* *[The Jungle Book](http://en.wikipedia.org/wiki/The_Jungle_Book)* by [Rudyard Kipling](http://en.wikipedia.org/wiki/Rudyard_Kipling)
* *[The Metamorphosis](http://en.wikipedia.org/wiki/The_Metamorphosis)* by [Franz Kafka](http://en.wikipedia.org/wiki/Franz_Kafka)
* *[The Time Machine](http://en.wikipedia.org/wiki/The_Time_Machine)* by [H. G. Wells](http://en.wikipedia.org/wiki/H._G._Wells)

However, there are still some details to be improved.
Continue reading “A closer look at Classics.app”

随手翻译了一个 Colophon

Cover

[Linux System Programming](http://www.oreilly.com/catalog/9780596009588/) 封面上的图是在一个正在飞行机器上的人。早在莱特兄弟于 1903 年实现他们第一台“重于空气”的可控飞行器以前,世界上的许多人就已经在用简单而精致的机器探寻飞行的奥秘了。在二世纪或三世纪时,就有中国的诸葛亮在孔明灯中飞行的记录,这是第一个热气球。而在六至七世纪,许多中国人尝试将自己绑在大型的风筝上以在空气中飞行。

此外,据说中国还创造了会转动的玩具,它是直升机的早期版本,这个设计可能在莱昂纳多达芬奇对人类飞行进行早期尝试时给予了他灵感,而在 1845 年,他设计了一台扑翼机,一台试图通过展动翅膀载人于空中飞行的机器。尽管他从未将这台机器建造出来,扑翼机的鸟状结构影响了后续几个世纪对飞行器的设计。

绘于本书封面的这台飞行机器要比 James Means 在 1893 的模型飞行器更为精细,多出了螺旋桨。Means 后来给他的飞行器印制了一份使用手册,其中提到“于 Willard 山巅,Crawford 屋畔,觅一良所”来试验这台机器。

不过这类试验通常是很危险的,在十九世纪后期,Otto Lilienthal 建造了一些单翼机、双翼机和滑翔机,他是第一个展示出飞行是在人类可控的范围内的人,也因此获得了“飞行测试之父”的称号:他曾参与超过 2000 次滑翔机飞行,有时单次飞行距离就超过了一千英尺。他在 1896 年死于一次降落事故,在那次事故中他折断了脊椎。

飞行器还被称作机器鸟或飞行船,也偶尔会叫成人造信天翁 (Artificial Albatross) 这样华美的名字。人们对飞行器的热情现在依然高涨,直到今天还有航空爱好者在建造早期的飞行器。

封面图和章节题图来自 Dover Pictorial Archive。封面的字体是 Adobe ITC Garamond。正文字体是 Linotype Birka,标题字体是 Adobe Myriad Condensed,代码字体则是 LucasFont 的 TheSans Mono Condensed。

注:孔明灯的传说里并没有提到诸葛亮借此飞行,当为老外附会。

对各平台文本渲染技术的一个简短的介绍

上周末参加 [thossclub](http://groups.google.com/group/thossclub) 的讨论,对各平台文本排版与渲染技术做了一个简短的介绍,这个介绍的 slides 可以在这里下载: [text-rendering-tech.pdf](http://jjgod.org/docs/slides/text-rendering-tech.pdf) (6.1 MB, PDF)