Fix increasing font size of certain emojis

Before this commit, NeoChat has two methods of detecting whether or not a piece
of text was an emoji. One is through a regex, and the other is by using the ICU
library. The two methods are used in different parts of the code.

This commit removes the regex detector and instead uses ICU for all the places
where NeoChat needs to figure out whether or not a string is an emoji. This
fixes increasing the font size for messages that only consist of emoji when
certain emoji are used that the regex did not handle (such as the transgender
symbol and transgender flag emojis).
This commit is contained in:
Claire Elford
2024-09-07 18:16:09 +10:00
committed by Tobias Fella
parent ab4e1a86dc
commit f7533a454c
4 changed files with 43 additions and 43 deletions

View File

@@ -30,6 +30,7 @@ public:
return _instance;
}
Q_INVOKABLE bool isEmoji(const QString &text);
Q_INVOKABLE bool isValidJson(const QByteArray &json);
Q_INVOKABLE QString escapeString(const QString &string);
Q_INVOKABLE QColor getUserColor(qreal hueF);
@@ -53,6 +54,8 @@ inline QColor getUserColor(qreal hueF)
// https://github.com/quotient-im/libQuotient/wiki/User-color-coding-standard-draft-proposal
return QColor::fromHslF(hueF, 1, -0.7 * lightness + 0.9, 1);
}
bool isEmoji(const QString &text);
}
namespace TextRegex