Home > Enterprise >  Setting button title as unicode character
Setting button title as unicode character

Time:09-23

I have a custom circular button on which I wish to set the lower left pencil unicode as title. I had tried setting the image, but for some reason the image isn't showing up, so I thought of showing the unicode character.

Unicode for lower left pencil is - U 1F589 (Resource - https://www.fileformat.info/info/unicode/char/1f589/index.htm)

Code - customButton.setTitle("\u{1F589}", for: .normal) Issue - Doesn't work and just shows a question mark on the button.

If I use unicode for lower right pencil, then it works fine.

Code for right pencil - customButton.setTitle("\u{270E}", for: .normal)

Why isn't the code for left pencil working? Am I using the wrong way to set unicode characters for left pencil?

CodePudding user response:

Your code is fine. You just need to find another character. Lower-right pencil is an old character that has been around for a while judging by its unicode properties (its age is 1.1 versus 7.0). I guess they never thought the need for a lower-left pencil, until now, and it just needs more time before it's (hopefully) fully adopted.

https://util.unicode.org/UnicodeJsps/character.jsp?a=270e&B1=Show
Lower-right pencil renders on the official Unicode character property analyzer.

https://util.unicode.org/UnicodeJsps/character.jsp?a=1F589&B1=Show
Lower-left pencil, however, doesn't render.

CodePudding user response:

To display a character, it needs to be part of a font, and there is no system font on iOS or Mac that includes this character. In fact, I could only find two fonts on all of fontspace that include it. It is a very rare character.

Since it's been around since 2014 (Unicode 7.0), I doubt it will ever be picked up. It's a kind of a weird character. Neither it nor LOWER RIGHT PENCIL are emoji, so they aren't generally going to display the way you'd want them to, anyway. They're text-only glyphs.

There are a bunch of similar emoji, though:

  • Related