Squeaking in Russian
Last updated at 8:39 pm UTC on 1 November 2006
This page describes attempt to enable displaying/editing of Russian text in Squeak using m17n features of Squeak 3.8 and later. Russian support is currently in alpha stage.
To enable Russian Support you need:
- Install unicode fonts with Russian (I suggest use of ttfFontReaderRefactored from SqueakMap)
- RussianSupport from SqueakMap
- Set unicode fonts somewhere
- Switch to Russian locale
Do it from workspace in squeak 3.9 on network connected machine(works with Squeak3.9a-6690, hangs when changing fonts with Squeak3.9a-6693-md5 - probably something related to TTC speedup TODO3.9 ?):
Do it in workspace:
pkgUrls := #('http://kilana.unibe.ch:8888/ttfReaderRefactored/TTFSupport-Refactored-dao.13.mcz'
'http://kilana.unibe.ch:8888/RussianSupport/RussianSupport-dao.3.mcz').
pkgUrls do: [:pkgUrl | MczInstaller installStream: (HTTPSocket httpGet: pkgUrl)].
and this:
"sometimes squeak hangs when new fonts are being enabled - hope this make doIt more safe."
World collapseAll.
"This will ask for font directory - point to location where your ttf files reside. It also will suggest you to enable freshly installed fonts in browsers, etc."
TTFontReader suggestBatchInstallToUser.
"This switches locale to Russian - wait a couple of seconds".
Locale switchToID: (LocaleID isoLanguage: 'ru').

Two main issues:
1) Fonts
I failed to load unicode fonts (i.e. from windows) into stock 3.8 image - stupid me. There is TTCFontReader which seems to be designed specially for this purpose but it is broken and I couldn't find out a way to make use of it. As I didn't feel that I'll manage to get a fix from somebody else, I took TTFontReader and refactored it to the state when it is capable of load of unicode ttf files. Result is on SqueakMap: http://map1.squeakfoundation.org/sm/accountbyid/2bf29ca7-cb92-4c16-ae18-6b271117a660/package/2c1a81e1-4e86-40c8-90b5-824adc4263c5
I intoduced some changes into TTCFont caching policy, which don't seem to be clean or effient, but I wanted to start somewhere. At least it works for me now - I will think about how to do it properly later.
2) Infrastructure (converters, interpreters, RussianEnvironment class)
Work in progress is on SqueakMap: http://map1.squeakfoundation.org/sm/accountbyid/2bf29ca7-cb92-4c16-ae18-6b271117a660/package/bd882147-b377-468d-a4ed-d8e864193143
One thing is unclear to me: what LanguageEnvironment class>>leadingChar is needed for? Everyone seems to define it for his language, but I wonder - is it necessary for Russian? What value should it have for Russian? I set it to 0 for time being.
I had to patch Windows VM in order to make copy/paste work reliably,- without VM modification you can't copy Russian text from Squeak unless current keyboard layout is Russian. Following patch forces Windows to make better guess about clipboard contents. It is written in not very defensive way, but works without problems. Unix VM has several flags to manage conversions between VM and x windows system or os. Probably nothing to change there, but I need to grasp how it is supposed to work. LC_ALL should be set in environment to enable keyboard input for squeak. Copy/paste doesn't work at a moment - but I'll fix it for sure.
diff -c sqWin32Window.c~ sqWin32Window.c
2256c2256
< { HANDLE h;
---
> { HANDLE h, hLocale;
2258a2259
> DWORD *pLocale;
2271a2273
>
2287a2290,2296
>
> hLocale = GlobalAlloc(GMEM_MOVEABLE | GMEM_DDESHARE, sizeof(DWORD));
> pLocale = (DWORD *) GlobalLock(hLocale);
> *pLocale = GetUserDefaultLCID();
> GlobalUnlock(hLocale);
> SetClipboardData(CF_LOCALE, hLocale);
>
2288a2298
>
2296d2305
<