unicode titles for ui buttons?
Trying to add a fancy title to a UI button using Unicode characters.
vw['btn_underline'].title = u'U\u0332'works and gives me a button with an underlined capital U.
vw['btn_italic'].title = u'\u1D644'doesn't work. It should give the character MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL I. Instead, it shows Unicode character \u1D64 (LATIN SUBSCRIPT SMALL LETTER U) followed by the number 4.
What's up with that?
Hmm, picture doesn't show? Here's the link: https://www.dropbox.com/s/9plukw5hloyzz25/unicode_buttons.jpg
You can append
raw=trueto a Dropbox image URL to make it show up inline (I've already edited the post for you).
As for your actual question: I think you need to use
\U0001D644(the lowercase-u variant expects exactly four hex digits). Unfortunately though, this doesn't seem to work either, it just shows a [?] placeholder in my testing. It seems that the iOS system fonts don't support this character – it also doesn't show up on this page: graphemica U+1D644 (which works fine on OS X).
Well, that's disappointing. Though I guess it is too much to ask for every single obscure Unicode character to be available in the system font. How often are some of them going to be used?
So, any suggestion for a workaround?
I guess you could just use a regular "I" and set the font to bold-italic, something like this:
vw['btn_italic'].title = 'I' vw['btn_italic'].font = ('HelveticaNeue-BoldItalic', 22)
You may need to experiment with the size to make it look consistent.
Oh, of course! I don't know why I didn't think of that myself. That'll work just fine. Thanks!