TextArea Vs ListBox Text Kerning

Does anyone know why the text kerning (space between letters) is different on a listbox vs a TextArea?

I’ve made a class that when you click on a listbox cell, it throws a TextArea on top to allow you greater flexibility in editing such as editing text bigger than the cell. On a Mac, it’s seamless. On Windows 10, the text “jumps” when the TextArea appears because the width of the text is different from the listbox to the textarea.

Here’s how the widths compare when overlapped

And when side by side:

The TextArea copies the listbox’s font and textsize on open.

FWIW the issue does not appear in 2016R3 Win7 - perhaps it’s something to do with how Windows 10 handles fonts?

Does it do this with the standard Windows System font (Segoe)?

It looks like Stephen IS using the System Font Segoe.
That’s also the font I used for my test.

From what I can see with my font designer eyes at the maximum browser size, the ‘a’ is not exactly the same between the two lines. More precisely, the lower boucle does not seem to have exactly the same shape. Further tests would be needed at much larger point size, but. I would bet that accounts for the difference.

Instead of using System, use a named font and the problem should go away.

Thanks for all the thoughts!

It seems reproducible on Windows 7 and Windows 10 (and likely Windows 8).

Setting the font size to 0 greatly improves it. Font size 11 shows the difference quite strongly.

Setting to other fonts alas didn’t seem to make much difference.

I’ve made a ticket for this if you want to sign on:


Isn’t the Listbox kind of a “Xojo Custom Control”? Well, if they are doing Graphics.DrawString in there…:
See <https://xojo.com/issue/51032>: Windows System Font and TextSize is different in Controls and (Canvas.) Graphics
I don’t like the Status Closed (By Design), as this prevents custom controls to look like native Controls :frowning:

I’d guess you’re right. It must do it’s own drawing.

I’ll bet this could be fixed by drawing one character at a time yourself in the CellTextPaint as suggested in <https://xojo.com/issue/14770> (but the amount of work involved in that is more than I have time for, particularly given that I’m wrapping my text in the cell.)

Yeah, that would be absurd - but doable I guess. It may well be easier to just have a loud noise or something else happen on-screen at the same time to distract the user, so they don’t notice the change in the kerning. :slight_smile:

As a matter of interest, what version of Xojo are you using, and what platform - are you running virtual Windows, parallels etc. on a Mac or a physical Windows machine?

In any case I guess it doesn’t matter because it would be nice if it just worked as expected.

Michel, they are absolutely the same font (Segoe) as shown in the original post. It’s just the screen resolution and lack of ‘hinting’ that makes some characters look slightly different.

As a printing industry PrePress/Compositor/Finished Artist professional, I’ve also got a critical eye for fonts and Typography. I started my apprenticeship in 1977 :slight_smile:

Your suggestion of: [quote]Instead of using System, use a named font and the problem should go away.[/quote] was a good one.

LoL! :smiley:

It’s called mis-direction :slight_smile: Sometimes you have to do, what you have to do - nothing is perfect.

So what version of Xojo are you using? what platform, You’ve never told us.