support custom fonts from themes
This commit is contained in:
parent
3146d2c3b4
commit
f3ff5b6a2e
Binary file not shown.
BIN
AO2XPbase/font/igiari-cyrillic.ttf
Normal file
BIN
AO2XPbase/font/igiari-cyrillic.ttf
Normal file
Binary file not shown.
@ -1,4 +1,4 @@
|
|||||||
GAME_VERSION = "2.9.2"
|
GAME_VERSION = "2.9.3"
|
||||||
AOpath = "base/"
|
AOpath = "base/"
|
||||||
AO2XPpath = "AO2XPbase/"
|
AO2XPpath = "AO2XPbase/"
|
||||||
|
|
||||||
|
|||||||
69
gameview.py
69
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)
|
self.presentedEvidence.setGeometry(self.viewport.x() + 16, self.viewport.y() + 16, 70 * self.viewportScale, 70 * self.viewportScale)
|
||||||
|
|
||||||
# Theme fonts
|
# Theme fonts
|
||||||
fontDb = None
|
|
||||||
nameFont = None
|
|
||||||
textFont = None
|
|
||||||
fontDb = QtGui.QFontDatabase()
|
fontDb = QtGui.QFontDatabase()
|
||||||
fontDb.addApplicationFont(AO2XPpath + 'font/Igiari.ttf')
|
fonts = {
|
||||||
fontDb.addApplicationFont(AO2XPpath + 'font/Ace_Name_Regular.ttf')
|
"showname": {
|
||||||
nameFont = QtGui.QFont("Ace Name")
|
"QFont": QtGui.QFont(),
|
||||||
textFont = QtGui.QFont("Igiari")
|
"pointSize": self.nameFontPointSize,
|
||||||
nameFont.setPointSize(self.nameFontPointSize)
|
"widget": self.name,
|
||||||
textFont.setPointSize(self.textFontPointSize)
|
"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'
|
courtroomFonts = AO2XPpath + "ao2xp_themes/" + theme + '/courtroom_fonts.ini'
|
||||||
if exists(courtroomFonts):
|
if exists(courtroomFonts):
|
||||||
@ -1970,24 +1981,40 @@ class GUI(QtGui.QWidget):
|
|||||||
fontData[key.strip()] = value.split(',')
|
fontData[key.strip()] = value.split(',')
|
||||||
|
|
||||||
if "showname" in fontData:
|
if "showname" in fontData:
|
||||||
nameFont.setPointSize(int(*fontData["showname"]))
|
fonts["showname"]["pointSize"] = int(*fontData["showname"])
|
||||||
if "showname_bold" in fontData:
|
if "showname_font" in fontData:
|
||||||
nameFont.setBold(int(*fontData["showname_bold"]))
|
fonts["showname"]["family"] = fontData["showname_font"][0].strip()
|
||||||
if "showname_color" in fontData:
|
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:
|
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:
|
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.text.setFont(fonts["message"]["QFont"])
|
||||||
self.ao2text.setFont(textFont)
|
self.ao2text.setFont(self.text.font())
|
||||||
self.name.setFont(nameFont)
|
self.name.setFont(fonts["showname"]["QFont"])
|
||||||
|
|
||||||
for label in self.onscreenTimerLabels:
|
for label in self.onscreenTimerLabels:
|
||||||
label.resize(self.viewport.width(), label.sizeHint().height())
|
label.resize(self.viewport.width(), label.sizeHint().height())
|
||||||
label.setFont(nameFont)
|
label.setFont(self.name.font())
|
||||||
|
|
||||||
# Load emote buttons
|
# Load emote buttons
|
||||||
# TODO: Buggy on theme switch / reload
|
# TODO: Buggy on theme switch / reload
|
||||||
@ -2035,10 +2062,6 @@ class GUI(QtGui.QWidget):
|
|||||||
# os._exit(-2)
|
# os._exit(-2)
|
||||||
|
|
||||||
def _themeCommon(self):
|
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
|
# IC input and demo slider
|
||||||
viewportRight = max(self.viewport.x() + self.viewport.width(), 512)
|
viewportRight = max(self.viewport.x() + self.viewport.width(), 512)
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user