Skip to content

Commit

Permalink
font
Browse files Browse the repository at this point in the history
  • Loading branch information
HIllya51 committed May 8, 2024
1 parent 4f14460 commit df3e624
Show file tree
Hide file tree
Showing 18 changed files with 114 additions and 66 deletions.
20 changes: 15 additions & 5 deletions LunaTranslator/LunaTranslator/gui/settingpage_xianshishezhi.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,12 +248,13 @@ def callback(x):
"普通字体",
"空心字体",
"描边字体",
"阴影字体",
"描边字体_reverse",
"描边字体_2",
"投影字体",
"发光字体",
]
),
globalconfig,
"zitiyangshi",
"zitiyangshi2",
),
5,
),
Expand Down Expand Up @@ -287,9 +288,18 @@ def callback(x):
),
2,
),
],
[
("发光亮度", 3),
(getspinbox(1, 100, globalconfig, "shadowforce"), 2),
"",
("阴影强度", 3),
(getspinbox(1, 20, globalconfig, "shadowforce"), 2),
("投影距离", 3),
(
getspinbox(
0.1, 100, globalconfig, "traceoffset", double=True, step=0.1
),
2,
),
],
[],
[
Expand Down
37 changes: 22 additions & 15 deletions LunaTranslator/LunaTranslator/gui/textbrowser.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,15 @@ def paintEvent(self, event):
elif self._type == 1:
painter.fillPath(path, QBrush(self.m_contentColor))
painter.strokePath(path, pen)
elif self._type == 2:
w = self.m_fontOutLineWidth
while w > 0:
painter.fillPath(
path.translated(w, w),
self.m_contentColor,
)
w -= 0.2
painter.fillPath(path, self.m_outLineColor)

painter = QPainter(self)
painter.drawPixmap(0, 0, self._pix)
Expand Down Expand Up @@ -344,8 +353,6 @@ def showyinyingtext2(self, color, iter_context_class, pos, text):
self.toplabel2,
color,
globalconfig["miaobiancolor"],
globalconfig["miaobianwidth"],
globalconfig["miaobianwidth2"],
)
_.move(subpos[i])
_.setText(subtext[i])
Expand Down Expand Up @@ -395,8 +402,6 @@ def showyinyingtext(self, b1, b2, color):
self.toplabel2,
color,
globalconfig["miaobiancolor"],
globalconfig["miaobianwidth"],
globalconfig["miaobianwidth2"],
)

_.move(tl1)
Expand Down Expand Up @@ -690,22 +695,26 @@ def nearmerge(self, x, startpos, fonthira, fontorig):
self.settextposcursor(startpos)
return res

def guesscreatelabel(self, p, c1, c2, w1, w2):
if globalconfig["zitiyangshi"] == 2:
def guesscreatelabel(self, p, c1, c2):
if globalconfig["zitiyangshi2"] == 2:
label = BorderedLabel(p)
label.setColorWidth(c1, c2, w2)
label.setColorWidth(c1, c2, globalconfig["miaobianwidth2"])

elif globalconfig["zitiyangshi"] == 4:
elif globalconfig["zitiyangshi2"] == 3:
label = BorderedLabel(p)
label.setColorWidth(c2, c1, w2)
elif globalconfig["zitiyangshi"] == 1:
label.setColorWidth(c2, c1, globalconfig["miaobianwidth2"])
elif globalconfig["zitiyangshi2"] == 1:

label = BorderedLabel(p)
label.setColorWidth(c1, c2, w1, 1)
elif globalconfig["zitiyangshi"] == 0:
label.setColorWidth(c1, c2, globalconfig["miaobianwidth"], 1)
elif globalconfig["zitiyangshi2"] == 4:

label = BorderedLabel(p)
label.setColorWidth(c1, c2, globalconfig["traceoffset"], 2)
elif globalconfig["zitiyangshi2"] == 0:
label = PlainLabel(p)
label.setStyleSheet("color:{}; background-color:(0,0,0,0)".format(c1))
elif globalconfig["zitiyangshi"] == 3:
elif globalconfig["zitiyangshi2"] == 5:
label = ShadowLabel(p)
label.setColorWidth(
c1, c2, globalconfig["fontsize"], globalconfig["shadowforce"]
Expand All @@ -717,8 +726,6 @@ def solvejiaminglabel(self, word, font, tl1, tl2, fh):
self.parent,
globalconfig["jiamingcolor"],
globalconfig["miaobiancolor"],
globalconfig["miaobianwidth"],
globalconfig["miaobianwidth2"],
)

_.setText(word["hira"])
Expand Down
3 changes: 2 additions & 1 deletion LunaTranslator/files/defaultconfig/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@
"miaobianwidth2": 3,
"miaobianwidth": 1,
"miaobiancolor": "#eeeeee",
"zitiyangshi": 2,
"zitiyangshi2": 5,
"hira_vis_type": 0,
"iskongxin": true,
"isshowrawtext": true,
Expand Down Expand Up @@ -417,6 +417,7 @@
"shadowcolor": "blue",
"ocr_hori_extend": true,
"shadowforce": 5,
"traceoffset": 2,
"showcixing_touming": 30,
"cixingcolor": {
"形容詞": "aliceblue",
Expand Down
8 changes: 5 additions & 3 deletions LunaTranslator/files/lang/ar.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
"汉语翻译结果繁简转换": "الترجمة الصينية نتيجة التحويل",
"分词&假名分析器": "اسم مستعار و محلل",
"时间间隔": "الفاصل الزمني",
"阴影强度": "كثافة الظل",
"字数统计": "كلمة إحصائيات",
"添加游戏": "إضافة لعبة",
"连接进程": "عملية الاتصال",
Expand Down Expand Up @@ -524,7 +523,6 @@
"OCR最短间隔时间(s)": "التعرف الضوئي على الحروف أقصر الفاصل الزمني ( ق )",
"形状詞": "شكل الكلمات",
"离开进程": "ترك العملية",
"阴影字体": "خطوط الظل",
"保存": "حفظ .",
"前景窗口截屏": "لقطة من النافذة الأمامية",
"正则表达式替换": "استبدال التعبير العادية",
Expand Down Expand Up @@ -768,5 +766,9 @@
"可选取模式": "اختيار نمط",
"百度OCR": "بايدو التعرف الضوئي على الحروف",
"飞书OCR": "كتاب الطيران التعرف الضوئي على الحروف",
"讯飞OCR": "التعرف الضوئي على الحروف"
"讯飞OCR": "التعرف الضوئي على الحروف",
"投影字体": "عرض الخط",
"发光字体": "خط الانارة",
"发光亮度": "سطوع مضيئة",
"投影距离": "المسافة المتوقعة"
}
8 changes: 5 additions & 3 deletions LunaTranslator/files/lang/cht.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@
"普通字体": "普通字體",
"空心字体": "空心字體",
"描边字体": "描邊字體",
"阴影字体": "陰影字體",
"显示设置": "顯示設定",
"不透明度": "不透明度",
"原文颜色": "原文顏色",
Expand All @@ -112,7 +111,6 @@
"居中显示": "居中顯示",
"空心线宽": "空心線寬",
"描边宽度": "描邊寬度",
"阴影强度": "陰影强度",
"显示显示原文按钮": "顯示顯示原文按鈕",
"显示复制原文按钮": "顯示複製原文按鈕",
"显示朗读按钮": "顯示朗讀按鈕",
Expand Down Expand Up @@ -768,5 +766,9 @@
"可选取模式": "可選取模式",
"百度OCR": "百度OCR",
"飞书OCR": "飛書OCR",
"讯飞OCR": "訊飛OCR"
"讯飞OCR": "訊飛OCR",
"投影字体": "投影字體",
"发光字体": "發光字體",
"发光亮度": "發光亮度",
"投影距离": "投影距離"
}
8 changes: 5 additions & 3 deletions LunaTranslator/files/lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@
"使用正则表达式替换": "Replace with regular expression",
"接頭辞": "Joint diction",
"谷歌": "Google",
"阴影字体": "Shaded fonts",
"工具按钮颜色": "Tool button color",
"助詞": "Auxiliary word",
"連体詞": "Conjunctions",
Expand Down Expand Up @@ -192,7 +191,6 @@
"模糊匹配相似度限制": "Similarity limit of fuzzy matching",
"翻译器字体类型": "Translator Font Type",
"检测到游戏时自动开始": "Start automatically when a game is detected",
"阴影强度": "Shadow intensity",
"去除重复行": "Remove duplicate lines",
"字体大小": "font size",
"最短翻译字数": "Minimum number of translated words",
Expand Down Expand Up @@ -768,5 +766,9 @@
"可选取模式": "Selectable modes",
"百度OCR": "Baidu OCR",
"飞书OCR": "Feishu OCR",
"讯飞OCR": "IFlytek OCR"
"讯飞OCR": "IFlytek OCR",
"投影字体": "Projection font",
"发光字体": "Luminous font",
"发光亮度": "luminance",
"投影距离": "Projection distance"
}
8 changes: 5 additions & 3 deletions LunaTranslator/files/lang/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@
"普通字体": "Fuente normal",
"空心字体": "Fuente hueca",
"描边字体": "Fuente de dibujo",
"阴影字体": "Fuente de sombra",
"显示设置": "Configuración de la pantalla",
"不透明度": "Opacidad",
"原文颜色": "Color del texto original",
Expand All @@ -112,7 +111,6 @@
"居中显示": "Mostrar en el Centro",
"空心线宽": "Ancho de línea hueco",
"描边宽度": "Ancho de dibujo",
"阴影强度": "Intensidad de la sombra",
"显示显示原文按钮": "Mostrar el botón mostrar texto original",
"显示复制原文按钮": "Muestra el botón Copiar texto original",
"显示朗读按钮": "Muestra el botón de lectura en voz alta",
Expand Down Expand Up @@ -768,5 +766,9 @@
"可选取模式": "Modo seleccionable",
"百度OCR": "Baidu OCR",
"飞书OCR": "Flying Book OCR",
"讯飞OCR": "IFLYTEK OCR"
"讯飞OCR": "IFLYTEK OCR",
"投影字体": "Fuente de proyección",
"发光字体": "Fuente luminosa",
"发光亮度": "Brillo luminoso",
"投影距离": "Distancia de proyección"
}
8 changes: 5 additions & 3 deletions LunaTranslator/files/lang/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@
"普通字体": "Police normale",
"空心字体": "Polices vides",
"描边字体": "Police de bord",
"阴影字体": "Police d'ombre",
"显示设置": "Paramètres d 'affichage",
"不透明度": "Opacité",
"原文颜色": "Couleur originale",
Expand All @@ -112,7 +111,6 @@
"居中显示": "Affichage Central",
"空心线宽": "Poids de ligne creux",
"描边宽度": "Largeur de la bordure",
"阴影强度": "Intensité de l'ombre",
"显示显示原文按钮": "Afficher le bouton afficher le texte original",
"显示复制原文按钮": "Afficher le bouton copier le texte original",
"显示朗读按钮": "Afficher le bouton lecture",
Expand Down Expand Up @@ -768,5 +766,9 @@
"可选取模式": "Mode sélectionnable",
"百度OCR": "Baidu ocr",
"飞书OCR": "Livre volant ocr",
"讯飞OCR": "OCR volant"
"讯飞OCR": "OCR volant",
"投影字体": "Polices de projection",
"发光字体": "Polices lumineuses",
"发光亮度": "Luminosité lumineuse",
"投影距离": "Distance de projection"
}
8 changes: 5 additions & 3 deletions LunaTranslator/files/lang/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@
"普通字体": "Carattere normale",
"空心字体": "Carattere bianco",
"描边字体": "Carattere tratto",
"阴影字体": "Carattere ombra",
"显示设置": "Impostazioni di visualizzazione",
"不透明度": "Opacità",
"原文颜色": "Colore originale",
Expand All @@ -112,7 +111,6 @@
"居中显示": "Centra la visualizzazione",
"空心线宽": "Larghezza della linea vuota",
"描边宽度": "Larghezza tratto",
"阴影强度": "Intensità ombra",
"游戏最小化时窗口隐藏": "Nascondi finestra quando il gioco è minimizzato",
"游戏失去焦点时窗口隐藏": "Finestra nascosta quando il gioco perde fuoco",
"游戏窗口移动时同步移动": "Sincronizza il movimento quando la finestra di gioco si muove",
Expand Down Expand Up @@ -768,5 +766,9 @@
"可选取模式": "Modalità selezionabili",
"百度OCR": "OCR Baidu",
"飞书OCR": "OCR Feishu",
"讯飞OCR": "OCR IFlytek"
"讯飞OCR": "OCR IFlytek",
"投影字体": "Carattere di proiezione",
"发光字体": "Carattere luminoso",
"发光亮度": "luminanza",
"投影距离": "Distanza di proiezione"
}
8 changes: 5 additions & 3 deletions LunaTranslator/files/lang/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@
"普通字体": "標準フォント",
"空心字体": "中空フォント",
"描边字体": "線フォント",
"阴影字体": "シャドウフォント",
"显示设置": "表示設定",
"不透明度": "不透明度ふとうめいど",
"原文颜色": "テキストの色",
Expand All @@ -112,7 +111,6 @@
"居中显示": "中央揃え",
"空心线宽": "中空線幅",
"描边宽度": "線の幅",
"阴影强度": "シャドウ強度",
"显示显示原文按钮": "テキスト表示ボタンを表示",
"显示复制原文按钮": "テキストコピーボタンを表示",
"显示朗读按钮": "読み上げボタンを表示",
Expand Down Expand Up @@ -768,5 +766,9 @@
"可选取模式": "選択可能モード",
"百度OCR": "百度OCR",
"飞书OCR": "フライブックOCR",
"讯飞OCR": "アイフライテックOCR"
"讯飞OCR": "アイフライテックOCR",
"投影字体": "投影フォント",
"发光字体": "発光フォント",
"发光亮度": "発光輝度",
"投影距离": "とうえいきょり"
}
8 changes: 5 additions & 3 deletions LunaTranslator/files/lang/ko.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@
"普通字体": "일반 글꼴",
"空心字体": "빈 글꼴",
"描边字体": "테두리 글꼴",
"阴影字体": "그림자 글꼴",
"显示设置": "디스플레이 설정",
"不透明度": "불투명도",
"原文颜色": "원문 색",
Expand All @@ -112,7 +111,6 @@
"居中显示": "가운데 표시",
"空心线宽": "빈 선가중치",
"描边宽度": "테두리 너비",
"阴影强度": "그림자 강도",
"显示显示原文按钮": "원본 보기 단추 보이기",
"显示复制原文按钮": "원본 복사 단추 보이기",
"显示朗读按钮": "말하기 단추 보이기",
Expand Down Expand Up @@ -768,5 +766,9 @@
"可选取模式": "선택 가능 모드",
"百度OCR": "바이두 OCR",
"飞书OCR": "페이서 OCR",
"讯飞OCR": "아이플라이테크 OCR"
"讯飞OCR": "아이플라이테크 OCR",
"投影字体": "글꼴 투영",
"发光字体": "발광 글꼴",
"发光亮度": "광도",
"投影距离": "투영 거리"
}
8 changes: 5 additions & 3 deletions LunaTranslator/files/lang/pl.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@
"普通字体": "Normalna czcionka",
"空心字体": "Biała czcionka",
"描边字体": "Czcionka kresu",
"阴影字体": "Czcionka cienia",
"显示设置": "Ustawienia wyświetlania",
"不透明度": "Nieprzezroczystość",
"原文颜色": "Kolor oryginalny",
Expand All @@ -112,7 +111,6 @@
"居中显示": "Środkowy wyświetlacz",
"空心线宽": "Szerokość linii pustej",
"描边宽度": "Szerokość skoku",
"阴影强度": "Intensywność cienia",
"显示显示原文按钮": "Pokaż przycisk Pokaż oryginalny",
"显示复制原文按钮": "Pokaż przycisk Kopiuj oryginał",
"显示朗读按钮": "Pokaż przycisk Mów",
Expand Down Expand Up @@ -768,5 +766,9 @@
"可选取模式": "Tryby wyboru",
"百度OCR": "OCR Baidu",
"飞书OCR": "OCR Feishu",
"讯飞OCR": "OCR IFlytek"
"讯飞OCR": "OCR IFlytek",
"投影字体": "Czcionka projekcji",
"发光字体": "Jasna czcionka",
"发光亮度": "luminancja",
"投影距离": "Odległość projekcji"
}
Loading

0 comments on commit df3e624

Please sign in to comment.