Utils: Quote font-face in StyleHelper::fontToCssProperties

Font faces should be quoted. '.AppleSystemUIFont', which is the default
on macOS, would break the CSS parsing if not quoted.

This change uses single quotes (which is equivalent with double) for the
task, because inline CSS in HTML is usually already quoted with double
quotes.

Change-Id: I08d8de1131f58a9c968cf45acc636cb2b3b21700
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
This commit is contained in:
Alessandro Portale
2024-01-30 19:31:19 +01:00
parent d3b6140bce
commit 022ff621d4

View File

@@ -998,7 +998,7 @@ QString StyleHelper::fontToCssProperties(const QFont &font)
? "normal" : font.style() == QFont::StyleItalic
? "italic" : "oblique");
const QString fontShorthand = fontStyle + " " + QString::number(font.weight()) + " "
+ fontSize + " " + font.family();
+ fontSize + " '" + font.family() + "'";
const QString textDecoration = QLatin1String(font.underline() ? "underline" : "none");
const QString textTransform = QLatin1String(font.capitalization() == QFont::AllUppercase
? "uppercase"