Commit 900784d8 authored by Luis Javier Merino's avatar Luis Javier Merino Committed by Harald Sitter
Browse files

[kcms/keyboard] tastenbrett: fix display of non-BMP, PUA and Mc, Me

Some layouts, e.g. Ugaritic (layout ara variant uga) use codepoints
outside the BMP (U+10380 to U+1039F).

Other layouts use the Private Use Areas on planes 15 and 16. The
Swedish Sign Language (layout se variant swl) uses the PUA at plane 16
and is intended to be used with a font like the one at . The OLPC
Nepali keyboard (layout np variant olpc) uses a few glyphs at PUA at
plane 15.

Yet other layouts use keysyms for dead keys that are not in the internal
deadMap, e.g: the Church Slavonic (layout ru variant chu) uses combining
marks in the Cyrillic Extended-A Unicode block.

Also, the Russian Rulemak keyboard (layout ru variant rulemak) uses
U0300, U030F, ... instead of the corresponding dead_grave,
dead_doublegrave, ... keysyms.

So, support non-BMP characters, support PUA characters (Qt seems to
assume that Other_PrivateUse are non-printing), and apply Mc and Me
characters to space, to ensure they are displayed.
parent 2bdf70a7
......@@ -131,8 +131,17 @@ static QString keySymToString(KeySym keysym)
if (static_cast<KeySym>(xkbKeysym) == keysym) {
str = xkbKeysymToUtf8(xkbKeysym);
for (const auto &c : qAsConst(str)) {
if (!c.isPrint() && !c.isNull()) {
const auto ucs4Str = str.toUcs4();
if (!str.isEmpty()) {
const QChar::Category category = QChar::category(ucs4Str[0]);
if (category == QChar::Mark_NonSpacing || category == QChar::Mark_Enclosing) {
str.prepend(" ");
for (const auto &c : qAsConst(ucs4Str)) {
if (!QChar::isPrint(c) && !(c == 0) && !(QChar::category(c) == QChar::Other_PrivateUse)) {
str = "";
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment