diff --git a/gramps/gen/lib/styledtexttagtype.py b/gramps/gen/lib/styledtexttagtype.py
index 54866f7d4..587768ba4 100644
--- a/gramps/gen/lib/styledtexttagtype.py
+++ b/gramps/gen/lib/styledtexttagtype.py
@@ -53,6 +53,8 @@ class StyledTextTagType(GrampsType):
HIGHLIGHT = 6
SUPERSCRIPT = 7
LINK = 8
+ STRIKETHROUGH = 9
+ SUBSCRIPT = 10
_CUSTOM = NONE_TYPE
_DEFAULT = NONE_TYPE
@@ -67,6 +69,8 @@ class StyledTextTagType(GrampsType):
(HIGHLIGHT, _("Highlight"), "highlight"),
(SUPERSCRIPT, _("Superscript"), "superscript"),
(LINK, _("Link"), "link"),
+ (STRIKETHROUGH, _("Strikethrough"), "strikethrough"),
+ (SUBSCRIPT, _("Subscript"), "subscript"),
]
STYLE_TYPE = {
@@ -79,6 +83,8 @@ class StyledTextTagType(GrampsType):
FONTSIZE: int,
SUPERSCRIPT: bool,
LINK: str,
+ STRIKETHROUGH: bool,
+ SUBSCRIPT: bool,
}
STYLE_DEFAULT = {
@@ -91,6 +97,8 @@ class StyledTextTagType(GrampsType):
FONTSIZE: 10,
SUPERSCRIPT: False,
LINK: '',
+ STRIKETHROUGH: False,
+ SUBSCRIPT: False,
}
def __init__(self, value=None):
diff --git a/gramps/gui/widgets/styledtextbuffer.py b/gramps/gui/widgets/styledtextbuffer.py
index 59bd657e9..ca05136bc 100644
--- a/gramps/gui/widgets/styledtextbuffer.py
+++ b/gramps/gui/widgets/styledtextbuffer.py
@@ -47,6 +47,8 @@ from .undoablebuffer import UndoableBuffer
WEIGHT_BOLD = Pango.Weight.BOLD
STYLE_ITALIC = Pango.Style.ITALIC
UNDERLINE_SINGLE = Pango.Underline.SINGLE
+RISE_SUPERSUB = 5000
+SCALE_SMALL = 1 / 1.2
#-------------------------------------------------------------------------
#
@@ -68,7 +70,10 @@ ALLOWED_STYLES = (
StyledTextTagType.HIGHLIGHT,
StyledTextTagType.FONTFACE,
StyledTextTagType.FONTSIZE,
+ StyledTextTagType.SUPERSCRIPT,
StyledTextTagType.LINK,
+ StyledTextTagType.STRIKETHROUGH,
+ StyledTextTagType.SUBSCRIPT,
)
STYLE_TO_PROPERTY = {
@@ -79,7 +84,10 @@ STYLE_TO_PROPERTY = {
StyledTextTagType.HIGHLIGHT: 'background',
StyledTextTagType.FONTFACE: 'family',
StyledTextTagType.FONTSIZE: 'size-points',
+ StyledTextTagType.SUPERSCRIPT: 'rise',
StyledTextTagType.LINK: 'link',
+ StyledTextTagType.STRIKETHROUGH: 'strikethrough', # permanent tag
+ StyledTextTagType.SUBSCRIPT: 'rise',
}
(MATCH_START,
@@ -271,6 +279,12 @@ class StyledTextBuffer(UndoableBuffer):
self.create_tag(str(StyledTextTagType.ITALIC), style=STYLE_ITALIC)
self.create_tag(str(StyledTextTagType.UNDERLINE),
underline=UNDERLINE_SINGLE)
+ self.create_tag(str(StyledTextTagType.STRIKETHROUGH),
+ strikethrough=True)
+ self.create_tag(str(StyledTextTagType.SUPERSCRIPT),
+ rise=RISE_SUPERSUB, scale=SCALE_SMALL)
+ self.create_tag(str(StyledTextTagType.SUBSCRIPT),
+ rise=-RISE_SUPERSUB, scale=SCALE_SMALL)
# internal format state attributes
## 1. are used to format inserted characters (self.after_insert_text)
diff --git a/gramps/gui/widgets/styledtexteditor.py b/gramps/gui/widgets/styledtexteditor.py
index 5be0faa24..8c01bb101 100644
--- a/gramps/gui/widgets/styledtexteditor.py
+++ b/gramps/gui/widgets/styledtexteditor.py
@@ -113,6 +113,36 @@ FORMAT_TOOLBAR = (
False
+
+
+
+ False
+
+
+
+
+
+ False
+
+
+
+
+
+ False
+
+