fix: let x86 apps under FEX use the device's fonts (Epic launcher CJK text shows boxes) (#1168)

fix: let x86 apps under FEX use the device's fonts for CJK text
This commit is contained in:
MaxsTechReview authored and GitHub committed 2026-10-19 21:27:18 -04:00
1 parent af4f0a7edb
commit cfc6dfb05f
3 files changed
+31

No files matched your search

@@ -1232,6 +1232,7 @@ class Session:
seed_settings()
install_shims()
install_preload(files)
fex_module()["install_fonts"](files)
clear_playing()
sync_installations()
forget_sign_in()
@@ -61,6 +61,8 @@ SCAN_LIMIT = 4000
MODES = ("auto", "on", "off")
STEAM_VERBS = ("run", "waitforexitandrun")
ESCAPE = re.compile(rb"\\([0-7]{3})")
DEVICE_FONTS = "/usr/local/share/fonts/android"
FONT_RULES = "/etc/fonts/conf.d/66-droiddeck-device-fonts.conf"
def say(message):
@@ -352,6 +354,16 @@ def write_config(fex, root):
write_if_changed(os.path.join(CONFIG_DIR, "Config.json"), json.dumps(config, indent=2) + "\n")
def install_fonts(root):
target = os.path.join(root, FONT_RULES.lstrip("/"))
rules = read_text(FONT_RULES) or ""
if not os.path.isdir(DEVICE_FONTS) or "<fontconfig>" not in rules:
with contextlib.suppress(FileNotFoundError):
os.unlink(target)
return
write_if_changed(target, rules.replace("<fontconfig>", "<fontconfig>\n<dir>%s</dir>" % DEVICE_FONTS, 1))
def link_steam_sdk():
for sdk, candidates in (("sdk64", ("linux64", "ubuntu12_64")), ("sdk32", ("linux32", "ubuntu12_32"))):
link = os.path.join(HOME, ".steam", sdk)
@@ -454,6 +466,7 @@ def prepare(app=SNIPER_APPID):
if materialize(platform):
say("prepared %s as the x86 runtime" % os.path.basename(platform))
install_preloads(root)
install_fonts(root)
provider = None
if app == SNIPER_APPID:
provider = graphics_platform()
+17
View File
@@ -45,6 +45,8 @@ class FexTestCase(unittest.TestCase):
"WANTED": str(self.home / ".config/droiddeck/fex-wanted"),
"PRELOADS": str(self.tmp / "preloads"),
"HOST_PRELOAD": str(self.tmp / "ld.so.preload"),
"DEVICE_FONTS": str(self.tmp / "android-fonts"),
"FONT_RULES": str(self.tmp / "66-droiddeck-device-fonts.conf"),
}
patcher = mock.patch.dict(G, patches)
patcher.start()
@@ -261,6 +263,21 @@ class PrepareTest(FexTestCase):
self.assertEqual((root / "lib/i386-linux-gnu/droiddeck/libfaultreport.so").read_bytes(), b"report32")
self.assertEqual((root / "etc/ld.so.preload").read_text(), "/usr/$LIB/droiddeck/libfaultreport.so\n")
def test_device_fonts_reach_the_x86_runtime(self):
root = self.tmp / "root"
conf = root / str(self.tmp / "66-droiddeck-device-fonts.conf").lstrip("/")
rules = '<?xml version="1.0"?><fontconfig>\n<match target="pattern"></match>\n</fontconfig>\n'
self.write(self.tmp / "66-droiddeck-device-fonts.conf", rules)
FEX["install_fonts"](str(root))
self.assertFalse(conf.exists())
(self.tmp / "android-fonts").mkdir()
FEX["install_fonts"](str(root))
self.assertEqual(conf.read_text(), '<?xml version="1.0"?><fontconfig>\n<dir>%s</dir>\n<match target="pattern"></match>\n</fontconfig>\n'
% (self.tmp / "android-fonts"))
(self.tmp / "66-droiddeck-device-fonts.conf").unlink()
FEX["install_fonts"](str(root))
self.assertFalse(conf.exists())
def test_config_turns_thunks_on_only_when_complete(self):
FEX["write_config"]({"host_thunks": "/h", "guest_thunks": "/g", "thunks_db": "/db"}, "/root")
config = json.loads((self.home / ".local/share/droiddeck-fex/config/Config.json").read_text())