Add alternian text

This commit is contained in:
Dpeta 2023-02-23 02:12:16 +01:00
parent 8e3f5410b7
commit 595252a3d3
No known key found for this signature in database
GPG key ID: 51227517CEA0030C
7 changed files with 24 additions and 3 deletions

View file

@ -32,6 +32,7 @@ _ctagre = re.compile("(</?c=?.*?>)", re.I)
_smilere = re.compile("|".join(list(smiledict.keys())))
_memore = re.compile(r"(\s|^)(#[A-Za-z0-9_]+)")
_handlere = re.compile(r"(\s|^)(@[A-Za-z0-9_]+)")
_alternian = re.compile(r"<alt>.*?</alt>")
class pesterQuirk:
@ -175,6 +176,7 @@ class pesterQuirks:
re.finditer(_smilere, string),
re.finditer(_handlere, string),
re.finditer(_memore, string),
re.finditer(_alternian, string),
)
excludes.extend(matches)

Binary file not shown.

2
fonts/alternian/info.txt Normal file
View file

@ -0,0 +1,2 @@
license: Public Domain
link: https://www.fontspace.com/allis-daedric-font-f20263

View file

@ -40,6 +40,7 @@ _oocre = re.compile(r"([\[(\{])\1.*([\])\}])\2")
# _format_end = re.compile(r"(?i)</([ibu])>")
_honk = re.compile(r"(?i)\bhonk\b")
_groupre = re.compile(r"\\([0-9]+)")
_alternian = re.compile(r"<alt>.*?</alt>") # Matches get set to alternian font
quirkloader = ScriptQuirks()
_functionre = None
@ -184,6 +185,16 @@ class hyperlink_lazy(hyperlink):
self.string = "http://" + string
class alternianTag(lexercon.Chunk):
def __init__(self, string):
self.string = string
def convert(self, format):
if format == "html":
return f"<span style=\"font-family: 'AllisDaedric'\">{self.string}</span>"
return self.string
class imagelink(lexercon.Chunk):
def __init__(self, string, img):
self.string = string
@ -285,6 +296,7 @@ def kxlexMsg(msg: str):
def lexMessage(string: str):
lexlist = [
(mecmd, _mecmdre),
(alternianTag, _alternian),
(colorBegin, _ctag_begin),
# (colorBegin, _gtag_begin),
(colorEnd, _ctag_end),

View file

@ -1653,9 +1653,10 @@ class PesterWindow(MovingWindow):
if not self.config.defaultprofile():
self.changeProfile()
# Fuck you some more OSX leopard! >:(
# if not ostools.isOSXLeopard():
# QtCore.QTimer.singleShot(1000, self.mspacheck)
# Load font
QtGui.QFontDatabase.addApplicationFont(
os.path.join("fonts", "alternian", "AllisDaedric-VYWz.otf")
)
self.pcUpdate[str, str].connect(self.updateMsg)

View file

@ -17,6 +17,7 @@ add_data = [
"smilies;smilies",
"themes;themes",
"docs;docs",
"fonts;fonts",
"README.md;.",
"LICENSE;.",
"CHANGELOG.md;.",
@ -28,6 +29,7 @@ data_folders = {
"smilies": "smilies",
"themes": "themes",
"docs": "docs",
"fonts": "fonts",
}
data_files = {
"README.md": "README.md.txt",

View file

@ -56,6 +56,7 @@ def rainbow(text):
re.finditer(_smilere, text),
re.finditer(_memore, text),
re.finditer(_handlere, text),
re.finditer(_alternian_tags, text),
)
for match in match_chain:
for color_and_position in colors_and_positions:
@ -161,3 +162,4 @@ _smilere = re.compile("|".join(list(smiledict.keys())))
_urlre = re.compile(r"(?i)(?:^|(?<=\s))(?:(?:https?|ftp)://|magnet:)[^\s]+")
_memore = re.compile(r"(\s|^)(#[A-Za-z0-9_]+)")
_handlere = re.compile(r"(\s|^)(@[A-Za-z0-9_]+)")
_alternian_tags = re.compile(r"<alt>|</alt>")