Why does text get replaced with gibberish?

770
4
12-07-2017 12:33 PM
KenGorton
Esri Contributor

Probably a noob question.

Periodically some of the text in my app gets replaced with unintelligible strings of characters. See pic. I promise that in code all of the Text on this interface is in the English language using Latin characters in a pattern such as this:

text: qsTr("A Text String in English")

Yet every now and then on an unpredictable basis they get replaced by what you see in the pic. If I kill the app and relaunch it, the interface returns to the original, legible content. 

What did I do or not do that causes this and how do I fix it?

0 Kudos
4 Replies
PaulHaakma
Regular Contributor

One possible thing to check is what font you are using.

I had issues on Android where, if I didn't actually specify any font at all, or some particular fonts, would display gibberish - BUT at certain (seemingly unpredictable) sizes it displayed fine. So it was some combination of font and size.

I solved it by always specifying a font that I knew would work.

Easiest thing I did in the end was create a qml file called 'CustomText.qml' with the code below, and then always use that instead of Text objects.

Text {
font.family: "Noto Sans"
}

0 Kudos
PaulHaakma
Regular Contributor

Note another possible cause seems to be the FontLoader status not being fully loaded and ready prior to the text rendering. We had this issue pop up in yet another app, and moved the code that loaded the font right to the beginning of the app, prior to anything else and it seemed to help.

0 Kudos
LisaDubas
New Contributor

How do you fix this if you don't have the standard version of the software?  I am using the free version and can't add a second line of text to my title page because it just displays as gibberish.  I only have 2 words on the starting screen, which tell the viewer next to nothing about the app. 

0 Kudos
PaulHaakma
Regular Contributor

If your issue relates to using one of the ESRI templates then I guess you would need to raise it as a bug with ESRI.

0 Kudos