Fix wrong default font string for annotation tools

remotes/origin/release/21.12
Albert Astals Cid 4 years ago
parent b461c459d1
commit 818b714252
  1. 4
      part/data/tools.xml
  2. 7
      part/pageviewannotator.cpp

@ -81,13 +81,13 @@ Annotation
<tool id="5" type="typewriter">
<engine type="PickPoint" block="true">
<annotation type="Typewriter" color="#00ffffff" textColor="#000000" width="0"
font="Noto Sans\\,10\\,-1\\,5\\,50\\,0\\,0\\,0\\,0\\,0\\,Regular"/>
font="Noto Sans,10,-1,5,50,0,0,0,0,0,Regular"/>
</engine>
</tool>
<tool id="6" type="note-inline">
<engine type="PickPoint" color="#ffff00" hoverIcon="tool-note-inline" block="true">
<annotation type="FreeText" color="#ffffff00"
font="Noto Sans\\,10\\,-1\\,5\\,50\\,0\\,0\\,0\\,0\\,0\\,Regular"/>
font="Noto Sans,10,-1,5,50,0,0,0,0,0,Regular"/>
</engine>
</tool>
<tool id="7" type="note-linked">

@ -156,7 +156,12 @@ public:
// set font
if (m_annotElement.hasAttribute(QStringLiteral("font"))) {
QFont f;
f.fromString(m_annotElement.attribute(QStringLiteral("font")));
// Workaround broken old code that saved fonts incorrectly with extra backslashes
QString fontString = m_annotElement.attribute(QStringLiteral("font"));
if (fontString.count(QStringLiteral("\\\\,")) > 9) {
fontString.replace(QStringLiteral("\\\\,"), QStringLiteral(","));
}
f.fromString(fontString);
ta->setTextFont(f);
}
// set font color

Loading…
Cancel
Save