Solved How to show on Android "Erase back-left" character in QML
-
Hello friends!
I wanted to show a Unicode character of "erase back-left" (U+232B, ⌫) in my QML application for Android. Used it in Text component. On my Android 6.0 it shows, but on other versions doesn't show. How can I use it? -
This post is deleted! -
Hi @Davronito
it is most likely missing from the (default?) font in your application.
If you ship your own font that includes that character, it should show in all versions
-
@J-Hilk Ok, but how to "ship" my own font? and I don't know which font family supports that character. I found something at stackoverflow, does it help? https://stackoverflow.com/questions/26845239/how-to-change-font-family-in-qml-app
-
@Davronito
there are a couple of ways to do it.
For example QML has the font loader class:
https://doc.qt.io/qt-5/qml-qtquick-fontloader.htmlOr you could pack the ttf/otf (etc) into your resource file and simply load it during start up via
https://doc.qt.io/qt-5/qfontdatabase.html#addApplicationFont -
@J-Hilk Oh thanks you, bro! I think I've found the solution!
Column {
FontLoader { id: fixedFont; name: "Courier" }
FontLoader { id: webFont; source: "http://www.mysite.com/myfont.ttf" }Text { text: "Fixed-size font"; font.family: fixedFont.name } Text { text: "Fancy font"; font.family: webFont.name }
}
Best regards!)
-
@Davronito
you're welcome!Don't forget to use the topic tools to set the topic to solved 😉