syntax on
set shiftwidth=4
set tabstop=4
set nobackup
set fileformat=unix
colorscheme darkblue
我在”How to add a new locale to Nokia 770″中记录了如何让Nokia 770显示中文以及添加zh_CN语言支持(Locale)。之后我试图简化那些步骤,开始想到的是制作一个rootfs image,包含有中文字体、添加了zh_CN Locale的locale-archive,但没成功。
后来想到制作两个deb 安装包,一个是中文字体,另外一个是locale-archive,基本上成功了。安装这两个包后,fc-list能列出中文字体,locale -a 也可以见到zh_CN,但唯独Opera 浏览器不能正确显示中文。反复试了好几次,情况还是一样。
回想上次成功的情况,有些怀疑是字体的问题了。我下载了两种中文字体,文泉驿和Firefly,每种都是三种格式的文件:TTF,BDF和PCF。PCF的文件比较小一些,所以我做deb包时用的是wqy的PCF文件。经过反复的试验,发现两种字体的PCF或BDF文件都可以使系统显示中文,但Opera浏览器除外。而使用TTF格式的文件时,只有Firefly可以使Opera浏览器正确地显示中文。看了文泉驿的安装说明,里面提到“这个字体采用了一种比较特殊的TTF格式,即SFNT TTF 格式。这种字体中只有点阵部分,而没有矢量部分”,不知道是不是这个原因?由于时间的关系,没有试验它安装说明文件里提到的ttf字体安装方法,也没有再去深究原因。
现在至少明白了只要安装了正确的字体(标准的TTF格式?),就可以让770支持中文显示了。似乎添加zh_CN的Locale有些多余了。
还有,这次参考了Maemotalk的这篇文章, 解决了titlebar不能争取显示中文的问题。只需修改所使用Theme的theme.xml,大概是第13行:
把中文字体的名字(可以在fc-list命令的输出中找到)写到原有字体名的前面,用|分隔,像这样
那个18px的数值可以根据情况调整。
等有空了,再做一个安装Firefly字体的deb包吧。
Below are steps on how to add a new locale to Nokia 770. I have added “zh_CN” locale to my Nokia 770 successfully, but I think it’s a “ugly” way to do this. Also note I only test this on IT OS 2006. So please do this on your own risk.
On your PC:
1. Prepare a Maemo development environment. Using ARMEL SDK rootstrap, install ‘locales’ package in scratchbox. After that, run ‘localdef’ to compile a new locale:
2. Verify it in sbox:
You should see the newly added locale in the output.
3. Copy /usr/lib/locale/locale-archive to your device.
On your device
4. Upgrade your device to Internet Tablet OS 2006.
5. Add Maemo Garage and Maemo respository to your Application Catalogue.
6. Follow this howto to get root access. You need install Xterm and Dropbear on your device.
7. Install ‘locales’ package by run this command in Xterm (as root):
8. Copy your font files to /usr/share/fonts/truetype, you may create a subdirectory for your font files in it. Run following commands to add the fonts:
9. Copy message files from ‘en_GB’ locale to your locale:
Note: DON’T overwrite those existing mo files.
10. Overwrite existing locale-archive file. Backup the original /usr/lib/locale/locale-archive first, then overwrite it by the one from sbox. DON’T use ‘cp’ command directly. It may cause the device to reboot. I use following commands to avoid this:
11. Verify it on your device:
Now, you should view characters in your language on Nokia 770, including Opera browser, Rss feed reader, File manager, etc. I put some screenshots on flickr.
In case something is wrong, you can reflash your device with the IT OS 2006 image.
Known issues:
拿到Nokia 770的第四天,终于可以看中文了,加上了zh_CN的locale支持和汉字字体。这里有一些屏幕截图。