Text Layout with Core Text (slides)

I did a talk in [Cocoaheads Beijing](http://cocoaheadsbj.org) yesterday on the topic “Text Layout with Core Text”, and [here](http://jjgod.org/docs/slides/TextLayoutWithCoreText.pdf) is my slides (4 MB, pdf).

slides download

I may write a more detailed article on [Core Text](http://en.wikipedia.org/wiki/Core_Text) typesetting later, stay tuned.

Effective code injection for Snow Leopard 64-bit apps?

Recently I’m looking for a way to make [Safari AdBlock](http://burgersoftware.com/en/safariadblock) support Safari in 64-bit.

64-bit apps stopped loading [Input Manager](http://www.cocoadev.com/index.pl?InputManager) bundles, so it is impossible to use [SIMBL](http://www.culater.net/software/SIMBL/SIMBL.php) in 64-bit apps either. Neither does [PlugSuit](http://infinite-labs.net/plugsuit/) (which is using [mach_inject](http://rentzsch.com/mach_inject/)). The [web plugin solution](http://www.switchersblog.com/2007/08/the-end-of-th-2.html) suggested by 1Password team stopped working too. Frankly, I think it’s time to start looking for a better code injection technique for 64-bit Snow Leopard apps seriously.

What still works?

1. [Scripting Additions](http://developer.apple.com/technotes/tn/tn1164.html), it’s what 1Password using for all its plugins (for Safari, WebKit, Camino, NetNewsWire, etc.), basically it works for all apps that support Apple Scripts, but the problem is you’ll need to run a daemon to watch the launch of these apps, then send a custom Apple event to trigger the initialization of the code you inject.

2. Use a DYLD constructor as initialization point, then use `DYLD_INSERT_LIBRARIES` or techniques described [in this faq](http://www.mikeash.com/?page=pyblog/friday-qa-2009-01-30-code-injection.html) to trigger the load of this bundle or dynamic library. The problem is you will need all the users to modify their environment variables, which is cumbersome.

Is there any other solution? I’ll be glad to hear.

Snow Leopard vs. 3rd Party LCD Displays

**Update**: CWS provided a solution in comment: opening Terminal and entering `defaults -currentHost write -globalDomain AppleFontSmoothing -int 2`, after re-login, everything is back to normal again!

**Update**: Turns out the problem is not just from Dell, various 3rd party display manufactures including Samsung, LG, HP and EIZO also have the same issue.

A very tricky issue has been bothering me for a few months: in Snow Leopard, whenever I connected my [Dell 2408WFP](http://is.gd/2lYr1) monitor, every app launched after that will have [sub-pixel antialiasing](http://en.wikipedia.org/wiki/Subpixel_rendering) (aka. LCD Font Smoothing) **disabled**.

For a typography freak like me, it is a huge disaster.

The full story comes in two parts:

1. Prior versions of Mac OS X used to have this “Font smoothing style” option in System Preferences -> Appearances, it is not as complete as [fontconfig](http://www.fontconfig.org). But good enough for general public. A very unfortunate thing [I covered about a few months ago](/2009/03/17/snow-leopard-font-related-changes/) is, they simplified that option to a checkbox: Use LCD font smoothing when available.

in Leopard
in Leopard
in Snow Leopard
in Snow Leopard

2. But how did Snow Leopard determine whether it is “available”? It relies from information retrieved from the driver of the display. Let’s say if you have ten displays connected, and one of them is a CRT display instead of LCD, then all the applications in your system will **not** be able to use LCD font smoothing. Here comes the epic fail: Dell 2408WFP (and Dell 3008WFP, AFAIK), a perfectly fine LCD display, is **not** recognized as one by Mac OS X (both Leopard and Snow Leopard have this issue, I haven’t check earlier versions).

(Though my Dell 2408WFP is not recorgnized as a LCD display in Leopard, I can force sub-pixel rendering with the “Font smoothing style” option.)

With the combination of these two problems, I’m stucked. Either I can give up Snow Leopard or get a new display. But I simply don’t have enough space on my desk for another display. (And I really happy with the Dell 2408WFP, it works with all other devices: Xbox 360, Wii, PS2, etc., so I won’t abandon it for an [Apple LED Cinema Display](http://www.apple.com/displays/) for apparent reasons.)

This morning I just got a reply for my bug report from Apple Developer Connection, it said:

Thank you for contacting us regarding Bug ID# 6975903. The report you have submitted has been determined by engineering to be an issue with LDC Display. Please know that we are doing our best to inform Dell of the issue with the hope that they can implement the necessary changes. Please feel free to contact them regarding this issue to help alert them of its importance.

I felt even more desperate after receiving this. Because it seemed too rare that Apple (and Dell) won’t even care to fix. And since I have little knowledge about why and what need to be fixed from Dell, it will be really hard for me to push Dell on this issue.

To be honest, what I’m asking is pretty simple: if we cannot get back the original font smoothing level option, **at least give us a hidden preference item to turn on LCD font smoothing**, that won’t hurt the usability of Snow Leopard, right?

Mac 下使用常见主机

手头在玩的几个主机和掌机包括 Wii, PS2, Xbox 360, PSP 和 NDSL,大部分网上能找到的信息都是 PC 上的使用方法,Mac 下要用的话,偶尔有点地方需要注意的,这里顺便记录一下。

Wii 现在大家一般都软解后用 USB Loader,这个一般无非是把下载下来的游戏镜像文件复制到移动硬盘里的 WBFS 文件系统中,在 Mac 下,[WBFS for MacOS X](http://wakoopa.com/software/wbfs-for-macos-x) 是最方便的工具。偶尔需要提取 Wii 游戏光盘镜像时,[wiiscrubber-ng](http://github.com/jjgod/wiiscrubber-ng/tree/master) 是个不太完全的移植,我略作了一点修改。

PS2 无非是刻盘,这个用系统自带的 Disk Utility 就可以胜任。

Xbox 360 的刻盘稍微无法一点,因为是双层 DVD,有时需要设置分层点,[iBurn360](http://idog.appleguru.org/iBurn360/) 或者 [OSx360](http://osx360.tla.su/osx360/) 都可以设置分层点进行刻录,其中 OSx360 在刻录新的 Wave 3 游戏时,需要去掉“Require Stealth Verification”选项。

PSP 偶尔需要转换 CSO 和 ISO 格式,[Prometeus](http://www.wattks.com/macosx/sony/sony.html) 是一个很好的工具。

NDSL 没什么可说的,使用了烧录卡后就是往 TF 卡里复制游戏而已。

vim-cocoa 0.3 released

I’m pleased to announce vim-cocoa 0.3 is released. The main update is it now have full Mac OS X 10.6 support.

### What’s New?

#### 0.3.2

* Fix frame height calculation when GUI tabline is enabled
* Add back missing helptags

#### 0.3.1

* Fix crashing on loading non-UTF-8 menu translations (reported by ducksteven and dyroro)
* Fix delayed refreshing (reported by fishy)

#### 0.3

* Update vim to 7.2.245
* **Rewrote** part of the rendering process to increase performance, especially on Mac OS X 10.6
* Add clipboard support for console mode (running without `-g`)
* Use cmake to support out-of-directory build, see [BuildInstructions](http://code.google.com/p/vim-cocoa/wiki/BuildInstructions) for detail
* Build with `+ruby` and `+cscope` by default

### Download

* [googlecode](http://vim-cocoa.googlecode.com/files/vim-cocoa-0.3.2.zip)

#### View Source

* [github](http://github.com/jjgod/vim-cocoa/tree/master)

If you found any issue, please file it [here](http://code.google.com/p/vim-cocoa/issues/entry).