diff options
author | Jordi Pujol Foyo <jordi@vikingsoftware.com> | 2020-05-08 15:23:21 +0200 |
---|---|---|
committer | Jordi Pujol Foyo <jordi@vikingsoftware.com> | 2020-08-26 16:40:10 +0200 |
commit | 560117351cd1e032c30e2691a2e933e3ebb84edd (patch) | |
tree | 9134bc2119f5ae0089642aeff842a4c67894a2bd /src/gui/text/qtextformat.h | |
parent | cba2d0443411b937586f259059e7f14c1cf5b512 (diff) |
Allow arbitrary baseline shift in QTextCharacterFormat
Added 6 new methods in QTextFormat and QTextDocument to
allow setting/getting specific % positioning for baseline and super/
subscript. Modified QTextLayout to honor those new settings.
[ChangeLog][QtGui][QTextLayout,QTextFormat,QTextDocument] Allow text
layout modification based on baseline offset and super/subscript % height
positioning
Fixes: QTBUG-18260
Change-Id: I0796f18224aac8df6baf8359c35022fd98fe64ef
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Diffstat (limited to 'src/gui/text/qtextformat.h')
-rw-r--r-- | src/gui/text/qtextformat.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/gui/text/qtextformat.h b/src/gui/text/qtextformat.h index e12f033596..9d422786f0 100644 --- a/src/gui/text/qtextformat.h +++ b/src/gui/text/qtextformat.h @@ -213,6 +213,9 @@ public: TextOutline = 0x2022, TextUnderlineStyle = 0x2023, TextToolTip = 0x2024, + TextSuperScriptBaseline = 0x2025, + TextSubScriptBaseline = 0x2026, + TextBaselineOffset = 0x2027, IsAnchor = 0x2030, AnchorHref = 0x2031, @@ -570,6 +573,21 @@ public: inline QString toolTip() const { return stringProperty(TextToolTip); } + inline void setSuperScriptBaseline(qreal baseline) + { setProperty(TextSuperScriptBaseline, baseline); } + inline qreal superScriptBaseline() const + { return hasProperty(TextSuperScriptBaseline) ? doubleProperty(TextSuperScriptBaseline) : 50.0; } + + inline void setSubScriptBaseline(qreal baseline) + { setProperty(TextSubScriptBaseline, baseline); } + inline qreal subScriptBaseline() const + { return hasProperty(TextSubScriptBaseline) ? doubleProperty(TextSubScriptBaseline) : 100.0 / 6.0; } + + inline void setBaselineOffset(qreal baseline) + { setProperty(TextBaselineOffset, baseline); } + inline qreal baselineOffset() const + { return hasProperty(TextBaselineOffset) ? doubleProperty(TextBaselineOffset) : 0.0; } + inline void setAnchor(bool anchor) { setProperty(IsAnchor, anchor); } inline bool isAnchor() const |