1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2025-01-18 19:52:09 +01:00

Added support for font-family style parameters

This commit is contained in:
Martin Tůma 2021-05-27 22:06:14 +02:00
parent 0f8478c380
commit 441ccc59d0

View File

@ -155,6 +155,7 @@ void Style::text(QXmlStreamReader &reader, const Rule &rule,
const QXmlStreamAttributes &attr = reader.attributes();
int fontSize = 9;
bool bold = false, italic = false;
QString fontFamily("Helvetica");
if (attr.hasAttribute("k"))
ri._key = attr.value("k").toLatin1();
@ -177,10 +178,20 @@ void Style::text(QXmlStreamReader &reader, const Rule &rule,
italic = true;
}
}
if (attr.hasAttribute("font-family")) {
QString family(attr.value("font-family").toString());
if (family == "monospace")
fontFamily = "Courier New";
else if (family == "serif")
fontFamily = "Times New Roman";
}
ri._font.setFamily(fontFamily);
ri._font.setPixelSize(fontSize);
ri._font.setBold(bold);
ri._font.setItalic(italic);
for (int i = 0; i < lists.size(); i++)
lists[i]->append(ri);