Skip to content
This repository has been archived by the owner on Jan 19, 2024. It is now read-only.

Commit

Permalink
Added font size for unsupported displays
Browse files Browse the repository at this point in the history
  • Loading branch information
DuckDuckG0ose committed Aug 21, 2023
1 parent 5a0ea17 commit 4b1172f
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 8 deletions.
File renamed without changes.
6 changes: 5 additions & 1 deletion Main.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
from servicetweak import servicetweak
from powerplan import powerplan
from TimerResolution import timerr
from fontchange import fontsize
from pypresence import Presence

def setup_logging(log_file='logs.txt'):
Expand Down Expand Up @@ -251,7 +252,7 @@ def selectmode():
print(f'\n \n')

try:
print(crayons.magenta(" [99.] light mode enable/disable | [10.] Discord "))
print(crayons.magenta(" [100.] Edit Screen size | [99.] light mode enable/disable | [10.] Discord "))
action = int(input(crayons.green(" What action would you like to perform: ")))

if action == 0:
Expand All @@ -264,6 +265,9 @@ def selectmode():
elif action == 2:
gametweaks()

elif action == 100:
fontsize()

elif action == 99:
if lightmode == False:
os.system("color f0")
Expand Down
Binary file added __pycache__/Main.cpython-311.pyc
Binary file not shown.
Binary file added __pycache__/fontchange.cpython-311.pyc
Binary file not shown.
34 changes: 34 additions & 0 deletions fontchange.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import ctypes

def set_cmd_font_size(size):
LF_FACESIZE = 32
STD_OUTPUT_HANDLE = -11

class COORD(ctypes.Structure):
_fields_ = [("X", ctypes.c_short), ("Y", ctypes.c_short)]

class CONSOLE_FONT_INFOEX(ctypes.Structure):
_fields_ = [("cbSize", ctypes.c_ulong),
("nFont", ctypes.c_ulong),
("dwFontSize", COORD),
("FontFamily", ctypes.c_uint),
("FontWeight", ctypes.c_uint),
("FaceName", ctypes.c_wchar * LF_FACESIZE)]

font_info = CONSOLE_FONT_INFOEX()
font_info.cbSize = ctypes.sizeof(CONSOLE_FONT_INFOEX)
font_info.nFont = 0
font_info.dwFontSize.X = 0
font_info.dwFontSize.Y = size
font_info.FontFamily = 54 # Modern
font_info.FontWeight = 400 # Normal
font_info.FaceName = "Consolas"

hndl = ctypes.windll.kernel32.GetStdHandle(STD_OUTPUT_HANDLE)
ctypes.windll.kernel32.SetCurrentConsoleFontEx(hndl, ctypes.c_long(False), ctypes.pointer(font_info))

def fontsize():
font_size = int(input("Enter font size: "))
set_cmd_font_size(font_size)
print(f"Font size updated to {font_size}")

14 changes: 7 additions & 7 deletions logs.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
2023-08-21 16:12:57,364 - INFO - Changed the window title.
2023-08-21 16:12:57,417 - INFO - Started rich presence.
2023-08-21 16:12:57,418 - INFO - Sucesfully started the script. Checking the version number...
2023-08-21 16:12:57,419 - INFO - Starting version checking squence
2023-08-21 16:12:58,182 - WARNING - Possible error while checking for version. Unsure.
2023-08-21 16:12:58,182 - INFO - Latest version is being used.
2023-08-21 16:12:58,183 - INFO - Ending version checking sequence.
2023-08-21 19:24:18,668 - INFO - Changed the window title.
2023-08-21 19:24:18,676 - INFO - Started rich presence.
2023-08-21 19:24:18,677 - INFO - Sucesfully started the script. Checking the version number...
2023-08-21 19:24:18,677 - INFO - Starting version checking squence
2023-08-21 19:24:19,077 - WARNING - Possible error while checking for version. Unsure.
2023-08-21 19:24:19,078 - INFO - Latest version is being used.
2023-08-21 19:24:19,078 - INFO - Ending version checking sequence.

0 comments on commit 4b1172f

Please sign in to comment.