Small number 9 instead of Apostrophe?

I’m using the Ubuntu font (available here: http://font.ubuntu.com/ ) in an app I’m building, and am seeing apostrophe characters being changed into small superscript number 9 characters.

Like this:

I’m sure the first inclination will be to blame the ubuntu font, but other apps on the same machine use this font correctly (i.e., with an actual apostrophe glyph), and I’ve had all kinds of other font problems with Xojo.

Has anyone else seen this before? What is going on here?

Thanks!

The nine superior is Unicode &u2079. Nothing to do with curly quotes, sometimes substituted by word processors.

Have you tried to change font ?

yes, I’ve changed fonts. Here is the same screen with the upper label using the OpenSans font (from google), with the lower label still using Ubuntu Light.

Note that the baseline / leading is all screwed up with the OpenSans font, but the apostrophe is correct.

Also, as soon as I changed the font, clicked another item in the UI editor, then clicked back to the label I just changed the font on, I can no longer change the font:

And this seems to be stuck this way. Reloading project / restarting Xojo makes no change. I can’t adjust the font on this Label anymore. :frowning:

In fact, now I can’t set the font for ANY label in this project in the IDE.

Time to fire up Feedback.

Click on the gear in the inspector and you should see the fonts again. This was changed for 2014r1.

Wow. What an annoying change. Odd that I didn’t notice it until just now, and that the font controls were where they used to be until I changed the font on this specific label.

At any rate… little nines instead of apostrophe characters. Any other thoughts?

What happens if you change the encoding of the string to UTF8?

This is an excellent question. After some research, it appears that the apostrophe character is expressed in UTF-8 as E2 80 99, and prints this character: ’ instead of the tick mark '. Modern text editors / word processors such as Word, Pages, etc will auto-change ’ to ’, as the typography is more pleasant that way.

The problem this introduces is that the apostrophe character was not included in the original ASCII character set, so it is must be interepreted as UTF-8. This should be all well and good, as Xojo has good support for multiple encodings.

Now, as to your question: I’m storing this string as a constant, where it appears there is no way to define the encoding. This means that in the IDE when laying out the window, if I set the value of the label to be #THE_NAME_OF_THE_CONSTANT it goes ahead and wires up the label to show the value of the named constant, with the incorrect character shown as I can only assume it is not encoding things correctly.

At runtime, I suppose I could re-set all the labels by running the constants through a defineEncoding() call, but why should I have to?

Is there really no way to define an encoding on a string constant?

Hmm, even when I explicitly set the label’s text to be the result of defineEncoding(CONSTANT_NAME, Encodings.UTF-8) I still get the wrong character showing there.

If I put a breakpoint on the define encoding call, I can see that the constant seems to think it is already using the UTF-8 encoding, (before being passed to defineEncoding(), so something else must be going on here.

A really tiny sample & bug report would be interesting to peek through
Platform ?
etc
Sounds like this should be really reproducible

Instead of a constant, what happens if you set the value as plain text ?

@Norman Palardy - here is the constant definition from the IDE:

Note that the apostrophe character there (in the what’s next?) is NOT just a tick mark, but is an actual apostrophe character, as discussed above.

Well not sure about the font but cutting a sentence from pages
Something funky with ‘something’ is going on
from Pages & pasting it into the value of the constant & using it shows the same as in Pages

OK I typed that exact same phrase into a little test here &, except for the font setting, things are fine.

What if you use a font like System ? Does it work fine ?
That would lead me to suspect the font somehow

EDIT : Scratch that
Installed all the fonts here on OS X 10.8.5 and things just work like I’d expect
No superscripted 9’s here

I think I’m beginning to agree with you Norm - I thought I’d seen this with other fonts, but I’ve tried several dozen now and have not been able to reproduce it on anything but the Ubuntu font. Even Ubuntu Mono does it correctly.

Dang. The decision maker really wanted to use this font. I’ll have to hunt for something else that is close and still handles baseline and leading correctly (nearly none that I’ve tried do so - see here: https://forum.xojo.com/5353-some-fonts-clipped-in-labels/p1#p72369 )

Odd I tried all three variants but not tons of sizes and got no little 9’s in any trials

Really? Could be as stupid as I need to re-download the Ubuntu font?

No idea - what font style & size were you trying ?
Any adornments like Bold Italic Underline etc ?

I’m just using the Ubuntu font plain. No adornments, and it happens at all sizes. Seems to be happening in other apps as well, such as Notepad and Pages. Even after re-installing the font.

How odd.

Well, bottom line: We can’t use the Ubuntu font. We’ll try others instead… which leads me to my latest bug report:
<https://xojo.com/issue/32967>

Just a thought - have you turned off Smart Quotes in the system preferences?
Apple symbol > System preferences… > Keyboard > Text > Uncheck “Use smart quotes and dashes”

(edit: I just read other fonts aren’t doing it - never mind, this probably isn’t it.)