uic: Generate QFont::HintingPreference
Task-number: QTBUG-113670 Pick-to: 6.5 Change-Id: I326d310b2a0df9a6f11e33588e553dff66e5a6f4 Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>bb10
parent
67b8dec0d0
commit
bfa557da91
|
|
@ -235,6 +235,13 @@ int FontHandle::compare(const FontHandle &rhs) const
|
|||
if (const int src = styleStrategy.compare(rhsStyleStrategy))
|
||||
return src;
|
||||
|
||||
const QString hintingPreference = m_domFont->hasElementHintingPreference()
|
||||
? m_domFont->elementHintingPreference() : QString();
|
||||
const QString rhsHintingPreference = rhs.m_domFont->hasElementHintingPreference()
|
||||
? rhs.m_domFont->elementHintingPreference() : QString();
|
||||
if (const int src = hintingPreference.compare(rhsHintingPreference))
|
||||
return src;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -1657,6 +1664,11 @@ QString WriteInitialization::writeFontProperties(const DomFont *f)
|
|||
m_output << m_indent << fontName << ".setStyleStrategy(QFont"
|
||||
<< language::qualifier << f->elementStyleStrategy() << ')' << language::eol;
|
||||
}
|
||||
if (f->hasElementHintingPreference()) {
|
||||
m_output << m_indent << fontName << ".setHintingPreference(QFont"
|
||||
<< language::qualifier << f->elementHintingPreference() << ')' << language::eol;
|
||||
}
|
||||
|
||||
return fontName;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3121,6 +3121,10 @@ void DomFont::read(QXmlStreamReader &reader)
|
|||
setElementKerning(reader.readElementText() == u"true"_s);
|
||||
continue;
|
||||
}
|
||||
if (!tag.compare(u"hintingpreference"_s, Qt::CaseInsensitive)) {
|
||||
setElementHintingPreference(reader.readElementText());
|
||||
continue;
|
||||
}
|
||||
reader.raiseError("Unexpected element "_L1 + tag);
|
||||
}
|
||||
break;
|
||||
|
|
@ -3166,6 +3170,9 @@ void DomFont::write(QXmlStreamWriter &writer, const QString &tagName) const
|
|||
if (m_children & Kerning)
|
||||
writer.writeTextElement(u"kerning"_s, (m_kerning ? u"true"_s : u"false"_s));
|
||||
|
||||
if (m_children & HintingPreference)
|
||||
writer.writeTextElement(u"hintingpreference"_s, m_hintingPreference);
|
||||
|
||||
writer.writeEndElement();
|
||||
}
|
||||
|
||||
|
|
@ -3229,6 +3236,12 @@ void DomFont::setElementKerning(bool a)
|
|||
m_kerning = a;
|
||||
}
|
||||
|
||||
void DomFont::setElementHintingPreference(const QString &a)
|
||||
{
|
||||
m_children |= HintingPreference;
|
||||
m_hintingPreference = a;
|
||||
}
|
||||
|
||||
void DomFont::clearElementFamily()
|
||||
{
|
||||
m_children &= ~Family;
|
||||
|
|
@ -3279,6 +3292,11 @@ void DomFont::clearElementKerning()
|
|||
m_children &= ~Kerning;
|
||||
}
|
||||
|
||||
void DomFont::clearElementHintingPreference()
|
||||
{
|
||||
m_children &= ~HintingPreference;
|
||||
}
|
||||
|
||||
DomPoint::~DomPoint() = default;
|
||||
|
||||
void DomPoint::read(QXmlStreamReader &reader)
|
||||
|
|
|
|||
|
|
@ -1645,6 +1645,11 @@ public:
|
|||
inline bool hasElementKerning() const { return m_children & Kerning; }
|
||||
void clearElementKerning();
|
||||
|
||||
inline QString elementHintingPreference() const { return m_hintingPreference; }
|
||||
void setElementHintingPreference(const QString &a);
|
||||
inline bool hasElementHintingPreference() const { return m_children & HintingPreference; }
|
||||
void clearElementHintingPreference();
|
||||
|
||||
private:
|
||||
|
||||
// child element data
|
||||
|
|
@ -1659,6 +1664,7 @@ private:
|
|||
bool m_antialiasing = false;
|
||||
QString m_styleStrategy;
|
||||
bool m_kerning = false;
|
||||
QString m_hintingPreference;
|
||||
|
||||
enum Child {
|
||||
Family = 1,
|
||||
|
|
@ -1670,7 +1676,8 @@ private:
|
|||
StrikeOut = 64,
|
||||
Antialiasing = 128,
|
||||
StyleStrategy = 256,
|
||||
Kerning = 512
|
||||
Kerning = 512,
|
||||
HintingPreference = 1024
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue