Friday, June 29, 2007

Hebrew diacritics and - WPF on XP - טקסט מנוקד ו

Well well well. Do you know how to type עִבְרִית שָׂפָה קָשָׁה? No, really? Don't worry. Press CapsLock, then holding Shift key type T(א) and then, without releasing it 8 (*). What we have how? Hallelujah, we have אָ. You can see almost all options here. Well, now we know to write hebrew diacritics (ניקוד). What's next? Use it in WPF of cause. Well just write small program in XAMLPad to see if it works.


Well done. It works. No, you have any problem? Ah, I know, you are using Windows XP. Am I right? Here how it looks like.


What's the ... Oh, sorry, I forgot to tell you, that such write method is an anachronism and those are bad characters. We have new shiny font set in Unicode U+FB## range to exchange all this stuff. Just take a look - it works fine (from the left old method, from the right new one)


So, that's the difference? See yourself. Try to select following two characters - you'll notice, that you, actually, have three.


So what's the problem? The problem is, that there is no normal input method for those new characters and the worth is that there are no enough characters (combinations) there. Open Character Map application, go the the very end of the page and notice two lines of such characters. Here they are


Pretty bad, ah? What the solution?

Before I describe a solution, I want you to understand what's the problem. The problem is, that in XP almost neither of fonts are non-OpenType. WPF in XP do not support left and right character shifting for those fonts in XP. This why you see what you see. The problem is not only related to Hebrew, but also for Chinese, Thai and all other fonts with shifting. WPF just drops support for those fonts in XP. That's definitely bug.

So what the solution? In XP (with Hebrew enabled) we have strange old system font named Lucida Sans Unicode - this is the only system Open Type font, so, if you set FontFamily property explicitly to force rendering and text engine to use this font, Hebrew will displayed properly.


Unforchantly, I do not know such fonts neither for Thai, nor for any other language, so if you, my dear readers, will find one (if it is), I'll be happy to update this post with your information.

Happy coding.

No comments: