[Etoys] Squeak VM status concerning language encodings

Bert Freudenberg bert at freudenbergs.de
Tue Dec 4 09:13:10 EST 2007


On Dec 4, 2007, at 13:43 , Luke Gorrie wrote:

> I'm making an effort today to understand squeak+unicode+fonts. I want
> to start really simple: to display a Devanagari unicode character in
> Squeak. I'd like to do this programatically to avoid potential
> problems with encoding, clipboards, etc.
>
> Here's what I tried:
> 1. Drag and drop a unicode Devanagari font into Squeak from
> http://nepalinux.org/fonts/samanata.ttf)

This font does not have a Unicode character mapping table, only a  
Windows and Macintosh one. I do not know how to map the 793 glyphs in  
the font to unicode code points without a proper table.

> 2. Print a unicode character in a workspace by evaluating: Unicode
> value: 16r0913
>
> I'd hoped to see a Devanagari character appear in the workspace but I
> only see '$?'.

You would have to set your workspace to the Samanata font first.

> I also tried this:
>   TextMorph new contents: ((Unicode value: 16r0913) asString);  
> openInHand
> which also showed as a ? even if I explicitly used the halo option to
> select the unicode font.

If you used a unicode font, that should have worked. This font does  
have Devanagari glyphs, and a unicode mapping:

http://www.nongnu.org/freefont/

If you file in the attached ttf reader hack (which I pointed to  
earlier) and then import FreeSans.ttf, you can get this:

-------------- nächster Teil --------------
Ein Dateianhang mit Binärdaten wurde abgetrennt...
Dateiname   : Workspace.png
Dateityp    : image/png
Dateigröße  : 20720 bytes
Beschreibung: nicht verfügbar
URL         : http://lists.laptop.org/pipermail/etoys/attachments/20071204/c432016e/attachment-0001.png 
-------------- nächster Teil --------------


I wonder if we should just switch to that font for now ...

> So I'd really like help with two questions:
> 1. How can I make it display the Devanagari character in my chosen  
> font?

Fix the font - or tell us how to fix the font reader without a  
correct character mapping table.

> 2. In general should the font selection be automatic -- if I print a
> unicode character should Squeak find a font that has the glyph? What's
> the algorithm?

There is no automatic font substitution - if a glyph is missing in  
the selected font, it is displayed as "?" or a hollow block.

> More generally I'm wondering whether I need to be worried about
> ligature and suchlike. Is this something that Squeak needs to
> understand (from hints in the font?) for straight import of text?

The current Squeak text renderer does not support ligatures,  
composing characters etc. The Pango-based one should take care of that.

- Bert -

-------------- nächster Teil --------------
Ein Dateianhang mit Binärdaten wurde abgetrennt...
Dateiname   : ttfGlyphs-bf.2.cs
Dateityp    : application/octet-stream
Dateigröße  : 12478 bytes
Beschreibung: nicht verfügbar
URL         : http://lists.laptop.org/pipermail/etoys/attachments/20071204/c432016e/attachment-0001.obj 


More information about the Etoys mailing list