Reputation: 1332
I need to draw a morph representing a card suit symbol or a card from a playing cards deck.
I was thinking to use the TextMorph and unicode characters for playing cards or suits, but can't find any example how to build a string from unicode characters and to display it properly in TextMorph.
Upvotes: 2
Views: 208
Reputation: 9378
I'm far from an expert, but this seems to go into the direction you want:
| aceOfDiamonds myTextMorph |
aceOfDiamonds := 16r1F0C1 asCharacter asString.
myTextMorph := TextMorph new newContents: aceOfDiamonds.
myTextMorph openInHand.
Now you can put this (editable) text morph somewhere, and its text will contain the character 🃁, but it will only display as a question mark. You might be able to change to a font that does display this correctly.
We can verify that the text does contain the correct character:
myTextMorph text asArray collect: [:c| c asUnicode].
prints #(127169)
.
Upvotes: 1