diff --git a/AO2XPbase/font/Igiari.ttf b/AO2XPbase/font/Igiari.ttf deleted file mode 100644 index 9b7be36..0000000 Binary files a/AO2XPbase/font/Igiari.ttf and /dev/null differ diff --git a/AO2XPbase/font/igiari-cyrillic.ttf b/AO2XPbase/font/igiari-cyrillic.ttf new file mode 100644 index 0000000..a846a88 Binary files /dev/null and b/AO2XPbase/font/igiari-cyrillic.ttf differ diff --git a/constants.py b/constants.py index 5f839b6..f452ebd 100644 --- a/constants.py +++ b/constants.py @@ -1,4 +1,4 @@ -GAME_VERSION = "2.9.2" +GAME_VERSION = "2.9.3" AOpath = "base/" AO2XPpath = "AO2XPbase/" diff --git a/gameview.py b/gameview.py index 041e3f2..5ce227e 100644 --- a/gameview.py +++ b/gameview.py @@ -1949,16 +1949,27 @@ class GUI(QtGui.QWidget): self.presentedEvidence.setGeometry(self.viewport.x() + 16, self.viewport.y() + 16, 70 * self.viewportScale, 70 * self.viewportScale) # Theme fonts - fontDb = None - nameFont = None - textFont = None fontDb = QtGui.QFontDatabase() - fontDb.addApplicationFont(AO2XPpath + 'font/Igiari.ttf') - fontDb.addApplicationFont(AO2XPpath + 'font/Ace_Name_Regular.ttf') - nameFont = QtGui.QFont("Ace Name") - textFont = QtGui.QFont("Igiari") - nameFont.setPointSize(self.nameFontPointSize) - textFont.setPointSize(self.textFontPointSize) + fonts = { + "showname": { + "QFont": QtGui.QFont(), + "pointSize": self.nameFontPointSize, + "widget": self.name, + "family": "Ace Name", + "color": "255, 255, 255", + "bold": 0, + "path": AO2XPpath + 'font/Ace_Name_Regular.ttf' + }, + "message": { + "QFont": QtGui.QFont(), + "widget": self.text, + "pointSize": self.textFontPointSize, + "family": "Igiari Cyrillic", + "color": "255, 255, 255", # Ignored but included for consistency + "bold": 0, + "path": AO2XPpath + 'font/igiari-cyrillic.ttf' + }, + } courtroomFonts = AO2XPpath + "ao2xp_themes/" + theme + '/courtroom_fonts.ini' if exists(courtroomFonts): @@ -1970,24 +1981,40 @@ class GUI(QtGui.QWidget): fontData[key.strip()] = value.split(',') if "showname" in fontData: - nameFont.setPointSize(int(*fontData["showname"])) - if "showname_bold" in fontData: - nameFont.setBold(int(*fontData["showname_bold"])) + fonts["showname"]["pointSize"] = int(*fontData["showname"]) + if "showname_font" in fontData: + fonts["showname"]["family"] = fontData["showname_font"][0].strip() if "showname_color" in fontData: - self.name.setStyleSheet("color: rgb(%s)" % ",".join(fontData["showname_color"])) + fonts["showname"]["color"] = ",".join(fontData["showname_color"]) + if "showname_bold" in fontData: + fonts["showname"]["bold"] = int(*fontData["showname_bold"]) + if "showname_fontpath" in fontData: # AO2XP exclusive + fonts["showname"]["path"] = AO2XPpath + "ao2xp_themes/" + theme + "/" + fontData["showname_fontpath"][0].strip() if "message" in fontData: - textFont.setPointSize(int(*fontData["message"])) + fonts["message"]["pointSize"] = int(*fontData["message"]) + if "message_font" in fontData: + fonts["message"]["family"] = fontData["message_font"][0].strip() if "message_bold" in fontData: - textFont.setBold(int(*fontData["message_bold"])) + fonts["message"]["bold"] = int(*fontData["message_bold"]) + if "message_fontpath" in fontData: # AO2XP exclusive + fonts["message"]["path"] = AO2XPpath + "ao2xp_themes/" + theme + "/" + fontData["message_fontpath"][0].strip() + + for w in ["showname", "message"]: + fontDb.addApplicationFont(fonts[w]["path"]) + QFont = fonts[w]["QFont"] + QFont.setPointSize(fonts[w]["pointSize"]) + QFont.setFamily(fonts[w]["family"]) + QFont.setBold(fonts[w]["bold"]) + fonts[w]["widget"].setStyleSheet("color: rgb(%s)" % fonts[w]["color"]) - self.text.setFont(textFont) - self.ao2text.setFont(textFont) - self.name.setFont(nameFont) + self.text.setFont(fonts["message"]["QFont"]) + self.ao2text.setFont(self.text.font()) + self.name.setFont(fonts["showname"]["QFont"]) for label in self.onscreenTimerLabels: label.resize(self.viewport.width(), label.sizeHint().height()) - label.setFont(nameFont) + label.setFont(self.name.font()) # Load emote buttons # TODO: Buggy on theme switch / reload @@ -2035,10 +2062,6 @@ class GUI(QtGui.QWidget): # os._exit(-2) def _themeCommon(self): - # Textbox - # self.name.setStyleSheet('color: white') - # self.text.setStyleSheet("background-color: rgba(0, 0, 0, 0); color: white;") - # IC input and demo slider viewportRight = max(self.viewport.x() + self.viewport.width(), 512)