Report salvaged and unreadable font descriptions after opening a project

Until now a font description that could not be parsed only produced
console warnings most users never see, so nobody learned that their
texts silently lost their formatting (see the reports in issue #553).

Count in QETUtils::fontFromString() how many descriptions were salvaged
from a foreign or corrupt format and how many stayed unreadable, and
show a message box after opening a project when either happened:
salvaged descriptions are rewritten in the stable format on the next
save, unreadable ones fall back to the default font. Projects without
font issues open exactly as before, and non-interactive opens only log
the counters.

Verified with a Qt 5.15 build on a project carrying 52 19-field and
one 21-field description: the dialog reports 53 restored descriptions;
the same file on a Qt 6.11 build (which parses those formats natively)
shows no dialog.

See issue #553.
This commit is contained in:
Dieter Mayer
2026-08-01 08:48:07 +02:00
parent 46cceb328e
commit 0fa2591c4f
3 changed files with 91 additions and 0 deletions
+3
View File
@@ -34,6 +34,9 @@ namespace QETUtils
void pixelSizedFont (QFont &font);
QString fontToString (const QFont &font);
bool fontFromString (QFont &font, const QString &description);
void resetFontRestorationCounters ();
int salvagedFontCount ();
int unreadableFontCount ();
bool sortBeginIntString(const QString &str_a, const QString &str_b);