Archive 17/01/2023.

Degree character in string displayed in UrhoSharp label

btschumy

I need to display a “degree” character in a Label in UrhoSharp.

On iOS, the character º works fine (type Option-0). When the app is run on Windows I get a “?” in its place.

The Windows degree character is /00B0 but that also displays a “?” in UrhoSharp. I tried using the Windows “Character Map” application and copied the degree character from there. It also displays “?” when the app is run.

Anyone know how to do this on Windows?

Modanung

Could it be font-related? It should be the same character when using the same font, right?

btschumy

I think that should be the character code for all fonts that have the glyph. I’m using Helvetica so that should be pretty standard.

Modanung

Well, there’s also things like ASCII/bitmap fonts.

I guess it’s a matter of the - usual - blaming Windows and using a superscripted o.o

btschumy

Ugh! But Urho3D should handle arbitrary Unicode strings when creating Labels, right?

Modanung

Well, it does - or does it? (Not sure about the technical reach of “arbitrary unicode”) - just not on Windows.

I know Urho can display Arabic, but does it bad; it requires string reversing and character map pasting for it to form words. Have you tried Klingon? That’s should be about as arbitrary as it gets.

btschumy

Is there any markup for superscripting, or do you have to display two labels appropriately placed, one with the number and one with the raised “o”.

weitjong

Yes, it is. But whether a glyph is rendered correctly or not depends on the TTF you use. Have you tried with other TTF? On Linux I have tried the TTF that is used in the HelloWorld example, changing the last exclamation character to the degree (U+00B0), and it is rendered correctly. I know it is not tested on Windows, but I just don’t see it will make any difference in this case.

btschumy

What TTF is used in the HelloWorld example?

I have tried using the built-in CoreAssets.Fonts.AnonymousPro
I’ve copied the following .ttf files from my c:\Windows\Fonts directory. arial.ttf, symbol.ttf

None of these seem to work. Only ASCII characters can be displayed (0x7E is the last that works). Anything above it yields a ?

This may be a Windows glitch. On iOS, I have no problem displaying it’s degree symbol.

Modanung

It think it would be more helpful if you taught yourself how to deduce this. :fishing_pole_and_fish:

How about other characters that would otherwise produce ?s?

I don’t use proprietary software, with the exception of nVidia drivers; I’m not the one to dive into this issue.

btschumy

Although I’m relatively new to Urho3D, I’ve spent a huge amount of time rummaging in the code trying to figure out how to do things do to the meager documentation. I’m well aware how to find this out. Here’s the relevant code from HelloWorld

// Set String to display
helloText->SetText("Hello World from Urho3D!");

// Set font and text color
helloText->SetFont(cache->GetResource<Font>("Fonts/Anonymous Pro.ttf"), 30);
helloText->SetColor(Color(0.0f, 1.0f, 0.0f));

So as I mentioned above, I have tried CoreAssets.Fonts.AnonymousPro. It does not work. Using the same code on iOS, it does. So it seems to be a Windows problem.

1vanK

No problems on Windows

P.s. Use UTF-8 encoding for your source files

btschumy

The files already are UTF-8 but that shouldn’t matter in this case. I’m encoding the character as “\u00B0” rather than typing it in directly.

I’m surprised it is working for you. That might implicate UrhoSharp as the problem. Perhaps something is lost in the bindings.

1vanK

UrhoSharp is dead. Try ***

btschumy

Microsoft doesn’t think it is dead. It is the basis of their HoloSharp effort. I have 4 months of work with UrhoSharp. It will take more than a faulty degree character to make me switch.

I have looked into *** and it doesn’t integrate well with Xamarin Forms.

1vanK

The last commit was two years ago https://github.com/xamarin/urho

Modanung

Ok… undead maybe. :zombie:

Modanung

It’ll be stuck in the past as long as you do not revive it yourself.

And taking Microsoft for their word? How? :confused:

Modanung