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:
- Drag and drop a unicode Devanagari font into Squeak from
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.
- 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:
I wonder if we should just switch to that font for now ...
So I'd really like help with two questions:
- 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.
- 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 -