Jump to content
Learn Chinese in China
  • Why you should look around

    Since 2003, Chinese-forums.com has been helping people learn Chinese faster and get to China sooner. Our members can recommend beginner textbooks, help you out with obscure classical vocabulary, and tell you where to get the best street food in Xi'an. And we're friendly about it too. 

    Have a look at what's going on, or search for something specific. We hope you'll join us. 

PinyinTones: type Pinyin with tone marks into any Windows program

Recommended Posts

taoyue    13

Announcing a new tool for typing Hànyǔ Pīnyīn with tone marks into Windows applications...

PinyinTones is a Windows Text Service for Windows Vista and Windows 7, 32-bit and 64-bit. The 64-bit evolution has truly arrived -- almost half of Windows 7 installations are 64-bit. And 64-bit applications are slowly ramping up -- Microsoft Office 2010 is the first version available natively for 64-bit.

You can download it from: http://www.pinyintones.com/

post-23975-077213100 1279471566_thumb.png post-23975-004496500 1279412482_thumb.png post-23975-009935100 1279412488_thumb.png post-23975-010487700 1279471194_thumb.png


  • PinyinTones requires the Visual C++ 2010 Redistributable Package (32-bit and/or 64-bit). The installer will automatically download and install the package from the Microsoft web site if you do not already have it installed.
  • Designed for Windows Vista and Windows 7. On these versions of Windows, PinyinTones will work in any application, whether or not it is TSF-aware.
  • Not recommended for Windows XP, which does not appear to have a TSF compatibility layer for non-TSF applications. On XP, PinyinTones will work only in TSF-aware applications.
  • Be sure to get the version that matches your install of Windows: 32-bit or 64-bit. If you do not know which one you are running, press WindowsKey+Pause to bring up the System information dialog. Next to "System type", it will tell you if you are running a 32-bit or 64-bit operating system.
  • PinyinTones registers itself as a Japanese text service. This was deliberately done to avoid the notorious bug in Microsoft Word that causes toned vowels to appear in a different font from surrounding consonants. Word does not do this for Japanese text services.

The source code is available on Codeplex under the Microsoft Public License, a permissive open-source license.

More details about PinyinTones:

  • PinyinTones is coded to the most modern API available on Windows, the Text Services Framework (TSF). This is the same framework used by Microsoft Pinyin and other Microsoft-supplied language text services, as well as by voice dictation and handwriting recognition.
  • Because it is written to the TSF, PinyinTones compiles right off-the-bat for 64-bit and 32-bit. TSF was introduced in Windows 2000 -- the first version of Windows to support a 64-bit processor (the Intel Itanium) -- and all the Microsoft sample code compiles directly for 64-bit without any tweaks.
  • PinyinTones makes use of the composition string display that is built into TSF-aware applications. This is how other TSF services operate, including the MS Pinyin text service for typing in Chinese characters. Compositions appear directly in the body of the text, with a dotted underline to indicate that they are still tentative.
  • PinyinTones was designed to be as unobtrusive as possible. There is no settings UI, because there are no settings.
  • There is no checked input, so there won't be any bugs in the checking algorithm to prevent you from entering Pinyin. If you type correct Pinyin, it will output correct Pinyin (with correct placement of tone marks on vowel combinations). If you type incorrect Pinyin, it will produce ... something. But it will never block you from entering something.
  • PinyinTones was designed to be a *very* simple program. I began with the Microsoft TSF sample code and changed fewer than 1000 lines of code. Less code means less that can go wrong.
  • Less code also means less functionality. You may have to adjust your input habits to use PinyinTones most efficiently. For example, Backspace will not remove tones. If you're selling something (mai4) and decide you want to buy it instead, just type 3 (mai43), and the tone will change.

PinyinTones has been developed independently from the existing Pinyinput IME and does not share any code.

The most notable differences:

  • Pinyinput is coded as an Input Method Editor (IME), a legacy API that dates back to Windows 95. Although Microsoft Windows is famously backward-compatible, there will inevitably be glitches from using a technology that is no longer being updated.
  • Pinyinput draws its own toolbar and its own composition window.
  • Pinyinput has a bunch of options, and a checked mode. Pinyinput is a more complex program than PinyinTones.

I have been in contact with Imron Alston, the author of Pinyinput. We agreed that it would be good to have both programs out there, so that the community can have the benefit of both design approaches.

PinyinTones or Pinyinput? Your choice. If you are running XP or need features such as checked mode, then use Pinyinput. If you want a simpler program that interacts better with newer versions of Windows and works on 64-bit, then use PinyinTones.

  • Like 3

Share this post

Link to post
Share on other sites
Site Sponsors:
Pleco for iPhone / Android iPhone & Android Chinese dictionary: camera & hand- writing input, flashcards, audio.
Study Chinese in Kunming 1-1 classes, qualified teachers and unique teaching methods in the Spring City.
Learn Chinese Characters Learn 2289 Chinese Characters in 90 Days with a Unique Flash Card System.
Hacking Chinese Tips and strategies for how to learn Chinese more efficiently
Popup Chinese Translator Understand Chinese inside any Windows application, website or PDF.
Chinese Grammar Wiki All Chinese grammar, organised by level, all in one place.

obe    0

taoyue - thanks for your very timely post!

I downloaded your program and it's working :) the only thing I'm missing there is the option to combine diacritical marks (which exists in Pinyinput). I realize that you are aiming for a minimal feature-set program, but was still wondering if you have such an option in the works, or if you have some commented out piece of code that could be easily integrated (even if by myself).

thanks again to you and to Imron for all your hard work!

Share this post

Link to post
Share on other sites
taoyue    13

Hi obe,

I am indeed aiming for a program with a minimum feature set (and also minimum UI). But could you give me a few examples of where you need to use combined diacritical marks? I'm not inclined to add this feature, but I'll at least think about it.

There is no commented-out code in PinyinTones. I really tried not to write any more code than I needed.

Share this post

Link to post
Share on other sites
obe    0


Well to be honest, this is kind of a personal requirement for me... I have written some tool to aid me in my studies, and it does some comparison of pinyin texts... and the entire database was built using "combine diacritical marks".

Anyway, I have already downloaded your code and modified it myself... it seems well written so despite having no experience in working with text services, I was able to easily find a good place to make my adjustments.

By the way, what I wasn't able to do is compile the setup program. It might be lack of understanding on my part, or maybe I don't have some required software installed, but the solution seemed not to load properly, and the setup programs didn't compile... eventually I simply installed with your provided setup, and then manually overwritten the DLL with my compiled DLL...

If you want more input or to discuss anything else and don't think it fits this forum, you are also welcome to email me.

Share this post

Link to post
Share on other sites
taoyue    13

Yes, I think it's best that you make your own changes to the code.

You need it for a very particular backward-compatibility purpose -- because you already built a database using combining diacritical marks, for a program (your own) that does not do Unicode normalization before string comparisons. I'm willing to leave this feature out for simplicity -- and also because I believe that a general-purpose input tool (i.e., not a tool specifically intended to output Unicode compositions) should output the most normalized form (Unicode Normalization Form C).

Visual Studio changes the project GUID upon opening the .sln. This causes the Setup##.vdproj to refer to a nonexistent project. For now, you can workaround the problem by diff'ing it to see which GUID got changed, and then running a search-and-replace on the Setup##.vdproj. This is obviously not an ideal solution! If you find a way to fix it, please let me know. So far, I've found lots of people discussing the problem at various places, but no solutions that actually work.

Edit: Found the problem. The setup projects now build in revision 54055.

Share this post

Link to post
Share on other sites
lwb0706    10

My old Windows XP machine crashed, and I was excited to replace it with a brand new 64-bit Windows 7 box. But my heart sank when trusty old Pinyinput didn't work anymore. Fortunately, this tool came to the rescue! Thank you so much for doing this -- it saved me the hassle of buying an old machine just so I could use Pinyinput!

Share this post

Link to post
Share on other sites
imron    3,681

Just an update to let you know that Pinyinput is now 64bit compatible too. See the release announcement here, or visit the Pinyinput project page on sourceforge.

Share this post

Link to post
Share on other sites
taoyue    13

I have just released a new version of PinyinTones, updated to work with Windows 8. It is available both in desktop applications and in Windows Store applications.

Available for download at: http://www.pinyintones.com/

On earlier versions of Windows, there may be improved stability on certain applications that are linked to a different version of the Visual C++ redistributables. PinyinTones is now linked to the system version of the redistributable. This is what Microsoft recommends, and it is what they do for their own IMEs. Thus, it should at least theoretically be an improvement.

Share this post

Link to post
Share on other sites
grawrt    197

Thank you! I just downloaded this to help with creating my decks and it's really helpful.

Just a note, when downloading it can be totally freaky cause you get a popup that says how its not often downloaded blah blah blah danger. I just got spyware the other day from downloading a chinese input system so I was a little wary but glad I went ahead with it because it's very easy to type with.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Blog Entries

    • roddy
      Signese Revival 9 By roddy in Signese 0
      One fairly random photo of Chinese characters in action, per week, until sometime in 2018. And perhaps longer if I'm encouraged. Those who want to contribute their own random photos of Chinese characters are welcome, just get in touch and I'll add you to the contributor list so you can post directly, from computer or phone.
      I wonder what a non-民用 key is. 

    • abcdefg
      Dim Sum Menu By abcdefg in Signese 0
      Here is the menu for the recent food article in which I reported on three mornings of Cantonese dim sum. This menu is from Yulong Seafood Hotpot Restaurant in Macau, near Ponte 16. The dim sum article is here: https://www.chinese-forums.com/forums/topic/54982-enjoying-dim-sum/?tab=comments#comment-424075
      (You can click the photos to enlarge them.)


      The waitress brings a pencil along with the menu, and you put a check mark below the items that you want to eat. She told me it didn't matter which box I checked, one of which is for ordering an item a la carte 单点 and the other for ordering an item as part of a larger meal 加单。
      She returns later with a typed receipt for the order as it was entered into their system. Always a good idea to double check at that point to be sure there was no mixup. Pricing category designations appear beside the name of the item: 特点,大点,中点,小点。

      I always try to pick up a blank extra menu so I can study it at my leisure later in the day and do a better job of ordering the next day.
    • js6426
      Week 3 By js6426 in Chinese Language And Literature Degree 4
      Sure thing!  So the book I was too lazy to grab is called 'Conversational Chinese 301'.  It's not bad, but unfortunately it has pinyin all the way through.  I find it so hard to concentrate on the characters when the pinyin is written underneath, but in theory you don't even need to pass HSK 3 to do this degree so I can understand it.  The degree itself is 'Chinese Language and Literature', and the only requirement was high school graduation, so very easy to get in for.  However, once you're in it seems like they won't have a problem kicking you out if you're not serious.  My teacher was not amused today when a guy strolled in an hour late, and another of my teachers said our class will probably go from the 28 we are out now down to around 20 students or so in the next couple of weeks as they deal with people not coming to class etc!

      Tomorrow we will finish the final chapter (8) of the first book of the 'Threshold' level of the Road To Success series, which contains 4 books.  On Wednesday we are meant to have a test on all the characters we have covered in the book (there aren't actually any in there, but we either had to find them or were given them so we could learn them).  By the end of the 4th book in this series we should have studied 1200 words (according to the back of the book).  The next stage then has 2 books, which gets us up to 3000 words, then the final stage has another 2 books, leaving us at 6000 words.  I actually really like this book, in fact I really like all the books we are using, I have found them especially helpful for stroke order.  I am far from perfect, but I find myself actively thinking about stroke order and getting it right much more of the time now.  Also, even though they are beginner books, I find I am having to learn characters that I would never have taken an interest in learning to write otherwise (things like fruit and vegetables).  This is great because it means I'm not getting bored just hearing stuff I have already learned repeated. 

      Last Friday I gave a brief description of a family photo.  It was an on the spot thing rather than prepared, so it wasn't until afterwards that I realized how bad it had been!  I pretty much just went through and said who everyone was, pointing at people or using the colour of their clothes to describe them.  I should have been using words like 旁边,前面,后面 etc. but I didn't.  Anyway never mind, it was good fun and reminded me to slow down and think a little bit more before I speak. 
      The quality of the teaching at this point is fantastic.  It's almost 100% Chinese which is great (although obviously spoken at more of a basic level so we can understand).  Our 'comprehensive' teacher relies very little on the book, and breaks off into his own little world all the time, which I actually really like as we end up getting all sorts of new words and culture points out of it.  He also teaches us things that we probably wouldn't learn for a while otherwise, like 公主病, 王子病,or how Q is commonly used in place of 可爱 on social media, or 3Q for 'thank you'!

      It's hard to know what to put in an update, but as I said, I would love to look back on this in 4 years and remember the start of this journey, so most of this is for me rather than anyone else!  But if anyone has any questions or anything, then please feel free to ask!
  • Recent Posts