Anthony Wong

Imagine

Follow me on TwitterRSS Feeds

  • Home
  • About me
  • Copyright
  • Archives
  • QR code WordPress plugin

Using Kai font for MacTeX on OS X

Jan 24th

Posted by anthony in Free Software

3 comments

Typesetting LaTeX with CJK on Mac OS X is provided out-of-box by MacTeX, so working with LaTeX should be a breeze on Mac OS X. However, MacTeX ships with only two Chinese fonts, Arphic Ming Big5 (bsmi) and Arphic Sung GB2312 (gbsn). As I want to use Kai I have to look around for solutions.

I found this great website that explains how to use LaTeX and the CJK package on OS X. The good news is that the author of the page provides a shell script for installing any Unicode truetype fonts for TexLive so that you can use the truetype fonts in your LaTeX documents. The bad news is… it doesn’t work on my system. I tried it on both Arphic Big5 and GB2312 Kai fonts, and when I ran my LaTeX document through the latex command (or in TeXShop, for that matters), I came to this error:

! Package inputenc Error: Keyboard character used is undefined
(inputenc)                in inputencoding `utf8'.

See the inputenc package documentation for explanation.
Type  H   for immediate help.
 ...                                              

l.194 ^^[
         ndinput

Trying the shell script on the STKaiti font (/Library/Fonts/华文楷体.ttf) shipped with OS X, is even worse, because ttf2tfm gives a "Bus error" (or segfault on Linux) when parsing the truetype font, looks like a bug in ttf2tfm:

$ ttf2tfm stkaiti.ttf -P 0 -E 3 -w "stkaitiu@Unicode@"
This is ttf2tfm version 1.5

stkaitiu00:

Glyph  Code   Glyph Name                Width  llx    lly      urx    ury
------------------------------------------------------------------------
Bus error

At the end, I resort to extracting the necessary files from Debian packages (hurray Debian) and put them into ~/Library/texmf, and that works!

The Debian packages I use are latex-cjk-chinese-arphic-bkai00mp and latex-cjk-chinese-arphic-gkai00mp. Since Debian packages are just ar archives, they can be extracted by the ar x command. After the deb package has been extracted, extract the data.tar.gz file, and then look for the folders called fonts and tex, move them to ~/Library/texmf, which you have to create. Now you should have a directory structure like this:

MacTex font installation

After the font files have been put in place, run these two commands (for the Big5 Kai truetype font):

$ sudo texhash
$ sudo updmap --enable Map bkaiu.map

For the GB2312 one, use:

$ sudo texhash
$ sudo updmap --enable Map gkaiu.map

It's that easy!

Popularity: 8% [?]

font, LaTeX, Mac, MacTeX, OS X

Beating a dead horse

Aug 8th

Posted by anthony in Hong Kong

No comments

民建聯主席馬力剛剛去世,因為馬力直譯成英文就是 “horse power”,這樣讓我聯想起一句英文諺語 “beating a dead horse”。這句諺語的意思是指不要為一些已經討論完畢或已下結論的議題再拿出來討論,或者是喋喋不休的討論一個不能改變的事情。現就馬力早前的“無恥”言論舉一例子:

“Every sane person knows that protesters had been killed during the June 4th Tiananmen crackdown, even the party has shut their mouth about this incident, telling the public that no one was killed is just beating a dead horse.”

這次馬真的是死了。

Popularity: 2% [?]

DAB, politics

Ajax Japanese handwriting recognition

Jul 13th

Posted by anthony in Technology

5 comments

Stumbled upon a toy which performs Japanese handwriting recognition online by using ajax as the frontend. As I said it’s just a toy so the correctness is so so, but nonetheless a very good proof-of-concept. This toy uses Support Vector Machine as the underlying algorithm so the program is able to learn from the user’s handwriting. Ever since I made lamerpad I realize that pattern recognition should be a better means to handle handwriting recognition than analyzing stroke patterns, such as stroke order, numbers and positions, which lamerpad employs, as stroke structures vary from person to person. But by using machine learning algorithms like SVM or artificial neural networks, a hybrid system could be made, such system not only can learn from how the character looks, but also how the character is written by the user. By now Chinese handwriting recognition technology is already quite mature, but just no such open source programs, SCIM handwriting module, anyone?

  • http://www.teresi.us/html/writing/handwriting.html: “Handwriting Recognition, Using a Neural Network Character Classifier”, have a description of Newton Messagepad’s handwriting recognition engine
  • http://www.byte.com/art/9609/sec17/art7.htm: overview of companies that work on Chinese handwriting recognition

Popularity: 12% [?]

AJAX, handwriting recognition, Japanese, lamerpad, SVM, Web

Google Calendar SMS Alert Comes to China

Jun 15th

Posted by anthony in China

3 comments

google-calendar-sms.png

Now Google Calendar users in China can finally enjoy the same SMS alert service as in other countries. Although they mentions China Unicom as the only mobile provider to be supported, I have no problem in registering the service and receiving alerts even I’m a China Mobile subscriber. This alert service is very handy to everyone, as Google Calendar will send you SMS to your mobile phone whenever an event is going to begin.

An interesting tidbit is, they sent the verification code to my mobile phone via HUTCHISON_HK, where HUTCHISON is one of the mobile service providers in Hong Kong. It seems that Google choose neither China Mobile nor China Unicom, the two major mobile providers in China, as their partners.

Popularity: 2% [?]

China, Google, Google calendar, SMS

Combining Google Maps and Google Ditu

Jun 5th

Posted by anthony in China

8 comments

Ditu (地圖, 地图) means map in Chinese. China has long been missing from the global Google Maps. Zooming into the China border, only patches of grey blocks are shown, occasionally with blue lines here and there indicating rivers and lakes, and worst of all, maps are just unavailable after you have drilled down deep enough.

Usually this doesn’t pose any problems as Google China serves China maps (and only China maps) at Google 地图, which provides all the functionalities of the global Google Maps website, sans satellite images. This is annoying nevertheless, it’d be the best if users can see maps of China seamlessly when they’re viewing maps.google.com, without jumping out from maps.google.com and then type in another URL just to view some data that’s still backwardly regarded by the Chinese authority as confidential and sensitive.

“Hybrid” mode for China maps is another feature that would be handy to Chinese users. Satellites images are already available but just not being shown on ditu.google.com. Since hybrid mode requires a special layer of map tiles, specially they have a transparent background so that the satellite images can show through underneath the maps, without post-processing map data provided by Mapabc this is not achievable. By Google’s terms of usage of the map data, processing the maps and then re-distribute is not legal. We can only use some freely redistributable map data such as from www.openstreetmap.org.

Hooking up maps.google.com with maps from Google China is not difficult, actually that’s much easier than I thought because Google Maps API already have the mechanism to add a new map type for showing custom map data. My proof-of-concept is shown below, press the “Ditu” button at the top right hand corner and you’ll see maps delivered from ditu.google.com.



Ideally, this “mashup” should best be implemented using the new Google Mapplets, this will give users the best user experience as they only need to add a mapplet and then Google China maps will be embedded to the map window automatically, users are not required to go to this page. But since Google Mapplets doesn’t support adding new map types due to security concerns, this currently is not an option. Frankly, I don’t see there’s any security concerns by supporting new map types.

Don’t be surprised if you notice that the satellite images do not align with the Google China maps, because Google China intentionally shifted the latter to please the Chinese authority. Did it say that the maps are regarded as national security?

Popularity: 6% [?]

China, Google, Google Ditu, Google Maps
«12345»10...Last »
  • Categories

    • China (27)
      • Beijing (11)
      • Hong Kong (3)
    • Fun/Humour (10)
    • Life (7)
    • Music (7)
    • Personal (10)
    • Technology (49)
      • Debian (11)
      • Free Software (7)
      • Linux (10)
      • Mac OS X (5)
  • Recent Comments

    • dan on QR code WordPress plugin
    • YU(required) on Google Calendar SMS Alert Comes to China
    • 流浪去 | 森路歷程 on 讓我想一想
    • Arqam on Tor, another way to get around the Great Firewall of China
    • QR code Generators « andrQid on QR code WordPress plugin
  • Recent Posts

    • Google Chrome is the winner, Javascript speed-wise
    • 商業電台網站大混亂
    • 帝國反擊戰
    • I helped Firefox today, I’m feeling great
    • Is switching proxies on Mac OS 10.5 scriptable?
    • Using Kai font for MacTeX on OS X
    • Beating a dead horse
    • Ajax Japanese handwriting recognition
    • Google Calendar SMS Alert Comes to China
    • Combining Google Maps and Google Ditu
  • My latest tweets

    Loading tweets...
    Follow me on Twitter!
  • Tags

    881903 AJAX AppleScript Beijing benchmark betrayer book China DAB Debian Firefox font Free Software FUD Google Google calendar Google Chrome Google Ditu Google Maps handwriting recognition internet Japanese Javascript joke lamerpad LaTeX Mac MacTeX Microsoft Mozilla networking ODF OOXML Open Source Opera OS X politics Safari SMS SunSpider SVM V8 Web web browser xcode
  • Affiliates

    • 120mobile
    • E70 手機手記
    • IT 笑话
  • Friends

    • Almerick
    • BenLauPedia
    • Open Your Thoughts
    • Sidekick
    • snailtalk
    • spacehunt
    • Stuart’s blog
    • Terence’s instant thoughts
    • voidoo
    • Winnie’s space ♬●•♪
    • yorick chan
    • Zunix’s OpenSourceAffairs
    • 亞當閒話
    • 小石头记
    • 狗爺語錄
    • 莎朗的神奇網誌
Mystique theme by digitalnature | Powered by WordPress
RSS Feeds XHTML 1.1 Top