Skip to content

Commit

Permalink
fix: scale font size for Segoe UI
Browse files Browse the repository at this point in the history
  • Loading branch information
CyanVoxel committed Jan 18, 2025
1 parent 58f6d2f commit da420d2
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions tagstudio/src/qt/splash.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,17 @@ def get_pixmap(self) -> QPixmap:
pixmap = QPixmap(960, 540)
pixmap.fill(QColor("black"))
painter = QPainter(pixmap)
point_size_scale: float = 1.0
match painter.font().family():
case "Segoe UI":
point_size_scale = 0.75

# TODO: Store any differing data elsewhere and load dynamically instead of hardcoding.
match self.splash_name:
case Splash.SPLASH_CLASSIC:
# Copyright
font = painter.font()
font.setPointSize(22)
font.setPointSize(math.floor(22 * point_size_scale))
painter.setFont(font)
pen = QPen(QColor("#9782ff"))
painter.setPen(pen)
Expand All @@ -88,7 +92,7 @@ def get_pixmap(self) -> QPixmap:
case Splash.SPLASH_GOO_GEARS:
# Copyright
font = painter.font()
font.setPointSize(22)
font.setPointSize(math.floor(22 * point_size_scale))
painter.setFont(font)
pen = QPen(QColor("#9782ff"))
painter.setPen(pen)
Expand All @@ -98,7 +102,7 @@ def get_pixmap(self) -> QPixmap:
)
# Version
font = painter.font()
font.setPointSize(22)
font.setPointSize(math.floor(22 * point_size_scale))
painter.setFont(font)
pen = QPen(QColor("#809782ff"))
painter.setPen(pen)
Expand All @@ -111,7 +115,8 @@ def get_pixmap(self) -> QPixmap:
# Copyright
font = QFont()
font.setFamily("Times")
font.setPointSize(22)
font.setPointSize(math.floor(22 * point_size_scale))
font.setWeight(QFont.Weight.DemiBold)
font.setStyleHint(QFont.StyleHint.Serif)
painter.setFont(font)
pen = QPen(QColor("#000000"))
Expand All @@ -122,7 +127,7 @@ def get_pixmap(self) -> QPixmap:
Splash.COPYRIGHT_STR,
)
# Version
font.setPointSize(22)
font.setPointSize(math.floor(22 * point_size_scale))
painter.setFont(font)
pen = QPen(QColor("#AA2A0044"))
painter.setPen(pen)
Expand Down

0 comments on commit da420d2

Please sign in to comment.