使用Scratchbox时遇到的一个小问题

在Scratchbox里用ls命令时遇到一个warning:

[sbox-SDK_PC: ~] > ls
ls: unrecognized prefix: su
ls: unparsable value for LS_COLORS environment variable


在scratchbox-user邮件列表里找到了办法:

http://www.mail-archive.com/scratchbox-users@lists.scratchbox.org/msg00309.html

修改scratchbox里的.bash_profile文件,加入

export LS_COLORS=

ADD Chinese Font in Nokia 770, 2006os

Below is a summary of the instructions on how to add Chinese fonts in Nokia 770, 2006OS. It's original hower's comment based on my previous post "How to add a new locale to Nokia 770". There are also two related threads on "internet tablet Talk" forum.

And a post on oafbot 's site, ノキア770:日本語表示可能

1. Find a copy of Truetype Chinese font. Fonts, simsun.ttf and simhei.ttf do not seem work in opera.
Font fireflysung.ttf (link: http://www.study-area.org/apt/firefly-font/ ) works.
2. Run x-terminal
3. Execute command sudo gainroot to enable root access privilege.
4. Copy fireflysung.ttf to /usr/share/fonts/fireflysung.ttf
5. Execute command fc-cache –f to rebuild system font cache information.
6. Exit from x-terminal.
7. Reboot the device
8. Now opera and all applications should be able to display Chinese font
correctly.

In order to have the theme display Chinese font on the title bar correctly additional steps as described below are needed
(http://guoyong.org/2006/08/11/248):

1. Run x-terminal
2. Execute command sudo gainroot to enable root access privilege.
3. Locate the theme type you selected. For example:

Deck-top
theme color file
Theme1 orange /usr/share/themes/default/matchbox/theme.xml
Theme2 light blue /usr/share/themes/theme1/matchbox/theme.xml
Theme3 dark blue /usr/share/themes/theme2/matchbox/theme.xml
Theme4 gray /usr/share/themes/theme3/matchbox/theme.xml

4. Change to directory where the theme you used is located. For example:

cd /usr/share/themes/default/matchbox/

5. Make a backup copy

cp –i theme.xml theme.xml.original

6. Copy theme.xml to mmc card

cp -i theme.xml /media/mmc1/theme.xml

7. Execute command fc-list to find the exact font name you installed for use later.

8. Open file theme.xml that is located in mmc card with Notes program
(comes with 2006os).
9. Find the line that defines the font as shown below:


10. Add the new font name and font size to it. Separate the fonts with |
The modified line is as shown below:


11. Save it.

12. Copy the modified theme.xml back to its original directory and overwrite it.

cp -i /media/mmc1/theme.xml \
/usr/share/themes/default/matchbox/theme.xml

13. Exit from x-terminal.

14. Reboot the device.

15. The device is good to go.

让Nokia 770支持中文显示

我在"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行:
font id="osso-TitleFont" def="Nokia Sans-17.85"
把中文字体的名字(可以在fc-list命令的输出中找到)写到原有字体名的前面,用|分隔,像这样
font id="osso-TitleFont" def="AR PL New Sung,文鼎PL新宋-17.85:18px|Nokia Sans-17.85"
那个18px的数值可以根据情况调整。

等有空了,再做一个安装Firefly字体的deb包吧。

How to add a new locale to Nokia 770

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:
[sbox-SDK_ARMEL: ~] > apt-get update
[sbox-SDK_ARMEL: ~] > fakeroot apt-get install locales
[sbox-SDK_ARMEL: ~] > localedef -f UTF-8 -i zh_CN zh_CN

2. Verify it in sbox:
[sbox-SDK_ARMEL: ~] > localedef --list-archive
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):
# apt-get install locales
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:
# fc-cache -f -v
# fc-list

9. Copy message files from 'en_GB' locale to your locale:
# cp -i /usr/share/locale/en_GB/LC_MESSAGES/*.mo \
/usr/share/locale/zh_CN/LC_MESSAGES/

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:
# cp /media/mmc1/locale-archive /usr/lib/locale/locale-archive-new
# cd /usr/lib/locale
# echo ""> locale-archive \
&& mv locale-archive-new locale-archive

11. Verify it on your device:
# locale -a
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:

  1. Web page title may not be displayed correctlly.
  2. DON'T change your region settings to your locale or you will NOT be able to input anything because the virtual keyboard disappears.