For example with the attached patch and changes to special_chars.xml you can work with multiple codepoint emojis (at least on my up-to-date KDE Plasma Manjaro Linux box).
Code:
<chargroup label="Emojis">
<cp hex="1F1E6 1F1F6" label="" desc="antartica flag"/>
<cp hex="1F3F3 FE0F 200D 1F308" label="" desc="rainbow flag"/>
</chargroup>
Code:
diff --git a/src/Dialogs/SelectCharacter.cpp b/src/Dialogs/SelectCharacter.cpp
index 762472dc8..3b0b5bb73 100644
--- a/src/Dialogs/SelectCharacter.cpp
+++ b/src/Dialogs/SelectCharacter.cpp
@@ -124,11 +124,17 @@ void SelectCharacter::SetList()
QString hexcd = xml_reader.attributes().value("", "hex").toString();
QString label = xml_reader.attributes().value("", "label").toString();
QString desc = xml_reader.attributes().value("", "desc").toString();
- bool ok = false;
- char32_t codepoint = (char32_t) hexcd.toUInt(&ok, 16);
- if (!ok) continue;
- QString sval = QString::fromUcs4(&codepoint, 1);
- QString entity = "&#x" + hexcd + ";";
+ // handle the case of a space delimted hex string for multiple codepoints such as emojis
+ QStringList cplist = hexcd.split(' ', Qt::SkipEmptyParts);
+ QString sval;
+ QString entity;
+ foreach(QString cph, cplist) {
+ bool ok = false;
+ char32_t codepoint = (char32_t) cph.toUInt(&ok, 16);
+ if (!ok) continue;
+ sval += QString::fromUcs4(&codepoint, 1);
+ entity += "&#x" + cph + ";";
+ }
custom_characters << sval << label << entity << desc;
}
}
And it appears to work just fine and does not mess with normal cp tags with only one hexcd.
So this would be a very very easy change to push now if people are interested.