Skip to content

Commit 4572606

Browse files
committed
feat: Automatically enable font smoothing
closes #4120
1 parent a846e67 commit 4572606

File tree

2 files changed

+45
-0
lines changed

2 files changed

+45
-0
lines changed

bottles/backend/managers/manager.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1444,6 +1444,13 @@ def components_check():
14441444

14451445
FileUtils.wait_for_files(reg_files)
14461446

1447+
logging.info("Enabling font smoothing…")
1448+
log_update(_("Enabling font smoothing…"))
1449+
rk.apply_font_smoothing()
1450+
wineboot.update()
1451+
1452+
FileUtils.wait_for_files(reg_files)
1453+
14471454
# blacklisting processes
14481455
logging.info("Optimizing environment…")
14491456
log_update(_("Optimizing environment…"))

bottles/backend/wine/regkeys.py

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,44 @@ def apply_cmd_settings(self, scheme=None):
224224
}
225225
)
226226

227+
def apply_font_smoothing(self, mode: str = "rgb"):
228+
"""Enable Wine font smoothing using a predefined mode."""
229+
230+
modes = {
231+
"disable": {"smoothing": "0", "orientation": 1, "type": 0},
232+
"gray": {"smoothing": "2", "orientation": 1, "type": 1},
233+
"bgr": {"smoothing": "2", "orientation": 0, "type": 2},
234+
"rgb": {"smoothing": "2", "orientation": 1, "type": 2},
235+
}
236+
237+
if mode not in modes:
238+
raise ValueError("Given font smoothing mode is not supported.")
239+
240+
selected = modes[mode]
241+
242+
self.reg.import_bundle(
243+
{
244+
"HKEY_CURRENT_USER\\Control Panel\\Desktop": [
245+
{"value": "FontSmoothing", "data": selected["smoothing"]},
246+
{
247+
"value": "FontSmoothingGamma",
248+
"data": "00000578",
249+
"key_type": "dword",
250+
},
251+
{
252+
"value": "FontSmoothingOrientation",
253+
"data": f"{selected['orientation']:08x}",
254+
"key_type": "dword",
255+
},
256+
{
257+
"value": "FontSmoothingType",
258+
"data": f"{selected['type']:08x}",
259+
"key_type": "dword",
260+
},
261+
]
262+
}
263+
)
264+
227265
def set_renderer(self, value: str):
228266
"""
229267
Set what backend to use for wined3d.

0 commit comments

Comments
 (0)