diff --git a/webinterface.py b/webinterface.py index 85faa020..4565be48 100644 --- a/webinterface.py +++ b/webinterface.py @@ -2242,10 +2242,24 @@ def htmlNewPost(mediaInstance: bool, translate: {}, return newPostForm +def getFontFromCss(css: str) -> (str, str): + """Returns the font name and format + """ + if 'src: url(' not in css: + return None, None + fontName = css.split("src: url('")[1].split("')")[0] + fontFormat = css.split(" format('")[1].split("')")[0] + return fontName, fontFormat + + def htmlHeader(cssFilename: str, css: str, lang='en') -> str: htmlStr = '\n' htmlStr += '\n' htmlStr += ' \n' + fontName, fontFormat = getFontFromCss(css) + if fontName: + htmlStr += ' ' htmlStr += ' \n' htmlStr += ' \n' return htmlStr