Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Unable to input Chinese (Chinese characters) ?
-
Unable to input Chinese (Chinese characters) ?
How to solve it?
-
Hi and welcome to devnet,
You might want to give more details about your situation.
-
Qt for WebAssembly currently does not support using local (system) fonts.
https://bugreports.qt.io/browse/QTBUG-81736You can add fonts to a resource file or download the fonts into the platform sandbox and then use
QFontDatabase::addApplicationFont or
QFontDatabase::addApplicationFontFromData(b) to load the font.You can then pick your font from the font chooser.
That part would work. Whether it will display correctly and be able to actually input might be a hit and miss right now. I have not been able to test font handling lately.
-
@lorn-potter Thank you very much.
I know how to display Chinese characters normally:int fontId = QFontDatabase::addApplicationFont(QStringLiteral(":/fonts/msyh.ttf")); QStringList fontFamilies = QFontDatabase::applicationFontFamilies(fontId); if ( fontFamilies.size() >0 ) { QFont font; font.setFamily(fontFamilies[0]); app.setFont(font); }
But ...
Just can't input Chinese characters
The problem made it impossible for me to start Chinese software. @_@