Search code examples
objective-cfontsnsattributedstringtruetypecs193p

How to apply striped fonts to special characters?


I am solving assignment #6 of 2013-2014 cs103p (however is not necessary to know the details of this assignment to answer). I have to implement (not the full version of) the set game, and display the cards in a collection of buttons. The symbols used are ▲,●,■.

I use an attributed string to represent the color of the symbol. The shadings are solid, striped and open. For a solid and striped symbol I just change the value of NSStrokeWidthAttributeName, which is non zero for an open character.

Now the problem comes with a striped character. I downloaded a font to represent striped characters: mexcellent. But the problem is that the stripes are applied only to regular alphabet characters, not to my symbols. How do I manage to represent these characters with stripes?


Solution

  • If you look at the character map of the font here: http://www.1001fonts.com/mexcellent-font.html#character-map

    You can see that your symbols aren't included in this font. The system just chooses another font to render these characters.

    You need to use a font which includes the desired symbols.