From 5c43dfe17544c54b8596e9ffd5c000e932186525 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=81=8D=E5=85=AE=E6=83=9A=E5=85=AE?= <1173718158@qq.com> Date: Sun, 19 Jan 2025 23:06:00 +0800 Subject: [PATCH] . --- .../rendertext/textbrowser_imp/miaobian0.py | 34 ---------- py/LunaTranslator/rendertext/webview.html | 13 ---- py/files/defaultconfig/config.json | 67 +++++-------------- 3 files changed, 18 insertions(+), 96 deletions(-) delete mode 100644 py/LunaTranslator/rendertext/textbrowser_imp/miaobian0.py diff --git a/py/LunaTranslator/rendertext/textbrowser_imp/miaobian0.py b/py/LunaTranslator/rendertext/textbrowser_imp/miaobian0.py deleted file mode 100644 index b7adafcde0a..00000000000 --- a/py/LunaTranslator/rendertext/textbrowser_imp/miaobian0.py +++ /dev/null @@ -1,34 +0,0 @@ -from qtsymbols import * -from rendertext.textbrowser_imp.base import base - - -class TextLine(base): - - def colorpair(self): - return QColor(self.basecolor), QColor(self.config["fillcolor"]) - - def paintText(self, painter: QPainter): - self.m_outLineColor, self.m_contentColor = self.colorpair() - fontOutLineWidth = self.config["width"] - - text = self.text() - font = self.font() - font_m = QFontMetricsF(font) - path = QPainterPath() - path.addText( - fontOutLineWidth, - fontOutLineWidth + font_m.ascent(), - font, - text, - ) - - pen = QPen( - self.m_outLineColor, - fontOutLineWidth, - Qt.PenStyle.SolidLine, - Qt.PenCapStyle.RoundCap, - Qt.PenJoinStyle.RoundJoin, - ) - - painter.fillPath(path, QBrush(self.m_contentColor)) - painter.strokePath(path, pen) diff --git a/py/LunaTranslator/rendertext/webview.html b/py/LunaTranslator/rendertext/webview.html index 12566926579..37c41adc2d1 100644 --- a/py/LunaTranslator/rendertext/webview.html +++ b/py/LunaTranslator/rendertext/webview.html @@ -104,18 +104,6 @@ ele.appendChild(style) return ele } - function miaobian0_create_internal(styleargs, text, args) { - - let ele = document.createElement('div') - maybesethtml(ele, args, text) - ele.style.color = styleargs.fillcolor - let _id = _simpleuid() - ele.id = _id - let style = document.createElement('style') - style.innerText = `#${_id}{-webkit-text-stroke: ${styleargs.width}px var(--${args.color});}` - ele.appendChild(style) - return ele - } function miaobian12_common(styleargs, text, args) { let c2 = `var(--${args.color})` let c1 = styleargs.fillcolor @@ -169,7 +157,6 @@ regist_style_imp = { normal: normal_create_internal, yinying: yinying_create_internal, - miaobian0: miaobian0_create_internal, miaobian1: miaobian12_common, } function dispatch_text_style_line(style, styleargs, text, args) { diff --git a/py/files/defaultconfig/config.json b/py/files/defaultconfig/config.json index d9fbc4c8fc6..d8d3363bf77 100644 --- a/py/files/defaultconfig/config.json +++ b/py/files/defaultconfig/config.json @@ -41,48 +41,32 @@ "argstype": { "fillcolor": { "name": "填充颜色", - "type": "colorselect" + "type": "colorselect", + "dynamic": true }, "shadowforce": { "name": "阴影强度", "type": "intspin", "min": 1, "max": 100, - "step": 1 + "step": 1, + "dynamic": true }, "shadowR": { "name": "阴影半径", "type": "spin", "min": 0, "max": 10, - "step": 0.01 + "step": 0.01, + "dynamic": true }, "shadowR_ex": { "name": "阴影半径", "type": "spin", "min": 0, "max": 100, - "step": 0.1 - } - } - }, - "miaobian0": { - "name": "描边字体_1", - "args": { - "fillcolor": "#eeeeee", - "width": 1 - }, - "argstype": { - "fillcolor": { - "name": "填充颜色", - "type": "colorselect" - }, - "width": { - "name": "描边宽度", - "type": "spin", - "min": 0, - "max": 100, - "step": 0.1 + "step": 0.1, + "dynamic": true } } }, @@ -98,32 +82,37 @@ "argstype": { "reverse": { "name": "反转颜色", - "type": "switch" + "type": "switch", + "dynamic": true }, "fillcolor": { "name": "填充颜色", - "type": "colorselect" + "type": "colorselect", + "dynamic": true }, "width": { "name": "描边宽度", "type": "spin", "min": 0, "max": 100, - "step": 0.1 + "step": 0.1, + "dynamic": true }, "width_rate": { "name": "描边宽度", "type": "spin", "min": 0, "max": 10, - "step": 0.01 + "step": 0.01, + "dynamic": true }, "trace": { "name": "投影距离", "type": "spin", "min": 0, "max": 100, - "step": 0.1 + "step": 0.1, + "dynamic": false } } } @@ -132,26 +121,6 @@ "normal": { "name": "普通字体" }, - "miaobian0": { - "name": "描边字体_1", - "args": { - "fillcolor": "#eeeeee", - "width": 1 - }, - "argstype": { - "fillcolor": { - "name": "填充颜色", - "type": "colorselect" - }, - "width": { - "name": "描边宽度", - "type": "spin", - "min": 0.1, - "max": 100, - "step": 0.1 - } - } - }, "miaobian1": { "name": "描边字体", "args": {