Squeak 5.0 – Displaying Accented Characters

If you want to display accented characters in Squeak 5.0 you need to find a TrueType font that contains the characters you want to see. Then you need to import it. Out of the box, TrueType font import is broken. If all you need are characters with Unicode code points under 256, you are fine. However, all characters with Unicode code points of 256 or above are silently discarded during the import. This saves on memory if you don’t need such characters. So for example English and German speakers are fine. If you do need to see such characters displayed however, follow these steps:

Step 1: Fix the code.

In

        TTFontReader>>#decodeCmapFmtTable:

change

                                i < 256 ifTrue:
                                        [seg last > 0 ifTrue:

to

                                        seg last > 0 ifTrue:

and

                                        cmap at: i + 1 put: code]]].

to

                                        cmap at: i + 1 put: code]].

or revert the method to the version

        'nice 12/27/2009 03:10'

.

In

        TTCFontReader>>#processCharMap:

change

                value = 65535 ifFalse: [ "???"

to

                value > 65535 ifFalse: [ "???"

.

Step 2: Import  the font.

| tmpStyleName tmpFontFileName |

tmpStyleName := #Arial.
tmpFontFileName := '/Library/Fonts/Arial.ttf'.

TTCFont removeStyleName: tmpStyleName.
"Remove the existing font if it exists"

TTCFont newTextStyleFromTTFile: tmpFontFileName.
"Import the new TTF font"

FontChooserTool open.
"Check that font"

Step 3: Test the font.

Open a Workspace.
Type a few national characters or paste them in with Cmd-V.
Příšerně žluťoučký kůň pěl ďábelské ódy.
Select all characters in Workspace with Cmd-A.
Choose a font for selected characters in Workspace with Cmd-K.
Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s