Faking CJK Support

When I released TextMate two years ago it was intended as a source code editor, and choices made during development reflects that, like its bias toward fixed width fonts and western input methods.

It has since surpassed my wildest expectations about what it would be used for, though until recently, CJK was still not an option.

But devoted users have made CJK bearable, the “hack” comes in two parts:

  1. A bundle by Hans-Joerg Bibiko with an input CJK command. This pops up a control where you can type the CJK text to be inserted.

    2006-11-12: There now is a CJK-input plug-in.

  2. A modified font that has the CJK glyphs in half width (screenshot), so they work with TextMate’s fixed width font display. Instructions for this are here.

I still hope to offer real CJK support in 2.0 (but please don’t send me hate mail if I do not come through). I am 90% decided on switching to CoreText for text rendering (and making 2.0 Leopard only) and when doing so, I will get rid of current text rendering limitations. The CJK input part is more tricky, but now that I have Apple Technical Support Incidents at my disposal, I am slightly more optimistic.


  1. 09 Nov 2006 | # R Lafourcade wrote…

    "I am 90% decided on switching to CoreText for text rendering (and making 2.0 Leopard only)…"

    Hooo… what a clever idea. I wonder how many license renewals you'll miss. One at the very minimum.

    Allan, I don't know if you use the "80/20 rule". it is somewhat valid – at least mathematically – ONLY when planning a new product or service with virtual consumers. You can make all the assumptions you want, the projected numbers tend to always fit with each other. But it's one thing to play with virtual things and another to play with existing customers. You have to be very carefull with your assumptions because one less customer is one less actual license. You have to hope that the number of new licensees will somehow compensate that "loss", but that's VERY optimistic.

    I like my Mac but I don't give a damn about Apple and their stupid codenames and incremental upgrades. I won't switch from Panther to Leopard just for the sake of giving you another 39 €. And I can live forever with textMate as it is.

    I hope I 'm not too rude, English is not my 1st language.

  2. 09 Nov 2006 | # p4bl0 wrote…

    @R Lafourcade : I remember a post on this blog in which Allan told that TextMate 2.0 could be free for people who bought a licence for TextMate 1.x.x

    But most of all, 39€ is not very expensive and i prefer to pay 39€ two times than 99€ for BBEdit ;-)

    Just something i don't know : is it possible to use CoreText for text rendering and at the same time don't use an NSTextView ? (I don't know anything in that domain so may be this question si stupid :-))

    P.S.: I'm french, so my english is certainly not good.

  3. 09 Nov 2006 | # Wes wrote…

    First I've heard of Core Text. Is there any more non-NDA info out there?

  4. 09 Nov 2006 | # Allan Odgaard wrote…

    I wrote an entry elaborating a bit on why I want to depend on Leopard.

  5. 09 Nov 2006 | # Jason Grossman wrote…

    I'll only be switching to Leopard if I can get it to work on a G3.

  6. 09 Nov 2006 | # Jacob Rus wrote…


    You need to realize that switching to leopard gives both Allan, and bundle developers, a ton of advantages, and allows him, and us, to more quickly develop kick-ass applications and extensions. Keeping Tiger support would be a weight around all of our necks. I'm really excited to be going Leopard only, as it means I can do a lot of things in Python that simply aren't possible with the stuff that comes with Tiger, and expecting every user to upgrade to a new version of Python and install PyObjC is not reasonable.

  7. 09 Nov 2006 | # Jacob Rus wrote…


    Also, I don't think it's any skin off Allan's back if you decide to use TM 1.5 into perpetuity. It's a great editor, and I'm sure you can do what you need with it. I expect you'll be sorry to miss some of the enhancements, but use whatever works for you. :)

  8. 09 Nov 2006 | # Niels K. wrote…

    Thanks for this post – espescially the japanese font works great. I would really wish to get true CJK-support in Textmate, even if this means getting through the same trouble of early-adopting as with Tiger (like this damn cisco-vpn-client which needed more than three months to get updated thus it worked with Tiger).

  9. 09 Nov 2006 | # moo wrote…


    that do not check input method.

    IM=defaults -currentHost read com.apple.HIToolbox AppleKeyboardScript

    if [ $IM != 'smRoman' ]; then osascript << EOF tell application "System Events" keystroke " " using command down end tell EOF fi

  10. 09 Nov 2006 | # moo wrote…

  11. 14 Nov 2006 | # Mark Patterson wrote…

    Even though you say TextMate was intended as a source code editor only, you can put any alphabet you like into web-pages, as long as unicode covers it. So it seems to me that including other alphabets is very much in the scope of the original idea. That means that for right-to-left alphabets you will have to do some smart stuff about integrating the left-to-right framework with r-to-l content! You must be having so much fun.

  12. 11 Dec 2006 | # pohet wrote…

    Yeah!!! That's what I wanted for a looong time! I'll buy it immidiately. You should consider send some money came from CJK area to Mr. hetima ;->

    Forced to switch Input Mode every time using TextMate makes myself using TM almost impossible! This bundle is really a delight.

    Of cource, I've waiting upcoming 2.0, which hopefully upport CJK natively.

  13. 23 Dec 2006 | # ethar wrote…

    too bad that those workarounds didn't work with me. I just got bad looking fonts with wide space between rows.

    I would volunteer as a Korean tester, if you like one.

  14. 09 Jan 2007 | # kazu wrote…

    I'm waiting for your true support for CJK in TextMate, thanks!

  15. 15 Jan 2007 | # ouwen wrote…

    I'm with kazu – I'll be waiting for real CJK support in TextMate. I was actually very unpleasantly surprised when reviewing some code samples today and noticed none of the chinese was showing up…

    Further more, why doesn't TextMate include an encoding library to open legacy encodings? It's not 1997 this year, let's get with the internationalization.

    Thank you.

  16. 03 Feb 2007 | # jc wrote…

    I think this is perfectly fine. If people want to use tiger, they can use 1.54. 2.0 should use the latest and greatest technologies in leopard. Don't punish the techies just to appease people who dont want to upgrade.

    It makes sense to me that if someone isnt bothered to upgrade their OS, then its unlikely they'll care about upgrading their text editor.

    Bring on the leopard only features! =)

  17. 25 Oct 2008 | # 日本語 wrote…

    I still long for a CJK textmate. It's very strange that Textmate can't handle Japanese Kanji. I think Textmate is a Cocoa based, then Why can't use japanese kanji? I think it's very easy to make a cocoa based text editer.

  18. 26 Dec 2008 | # Zing wrote…


    Not to mention Java lets you use whatever encoding you want and then whatever characters you want for names as long as Unicode thinks they are "letters".

    And that Ruby has supported Kanji from the outset, due to having been created in Japan.

  19. 26 Dec 2008 | # Zing wrote…

    Oh crap, I got owned by Markdown. :-( Serves me right for not paying attention.

Comments closed, you can use the mailing list for discussion.