mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-18 12:28:40 +00:00
Draw Steam's CJK and Thai text with the device's fonts (#374)
Steam ships no CJK font and the rootfs only has DejaVu, so a phone set to Chinese, Japanese or Korean got Steam in that language with every character drawn as a box. Bind Android's /system/fonts into the guest, index it again whenever it changes, and prefer the matching Noto CJK face for each language.
This commit is contained in:
1 parent
bd65f1660f
commit
d1760cd49f
3 files changed
+33
-1
No files matched your search
@@ -42,6 +42,8 @@ public final class LinuxRuntime {
|
||||
* session ended at once. A long host path behind it is proot's to shorten.
|
||||
*/
|
||||
public static final String GUEST_RUNTIME_DIR = "/run/droiddeck";
|
||||
private static final String SYSTEM_FONTS = "/system/fonts";
|
||||
private static final String GUEST_SYSTEM_FONTS = "/usr/local/share/fonts/android";
|
||||
/** Where every Linux session's debug log lands: public, so a user can just hand the folder over. */
|
||||
public static final String DEBUG_LOG_DIR = "DroidDeck";
|
||||
|
||||
@@ -207,6 +209,7 @@ public final class LinuxRuntime {
|
||||
File shm = new File(context.getCacheDir(), "shm");
|
||||
shm.mkdirs();
|
||||
bind(cmd, shm.getPath() + ":/dev/shm");
|
||||
bindSystemFonts(cmd, root);
|
||||
|
||||
// Android denies apps these; glibc, Steam and libcap read them at startup.
|
||||
File fakeProc = new File(root, "etc/droiddeck/proc");
|
||||
@@ -465,6 +468,15 @@ public final class LinuxRuntime {
|
||||
return byType;
|
||||
}
|
||||
|
||||
private static void bindSystemFonts(List<String> cmd, File root) {
|
||||
File fonts = new File(SYSTEM_FONTS);
|
||||
File target = new File(root, GUEST_SYSTEM_FONTS.substring(1));
|
||||
if (!fonts.isDirectory() || !fonts.canRead() || !new File(root, "usr/local").isDirectory()) return;
|
||||
if (target.isDirectory() || target.mkdirs()) {
|
||||
bind(cmd, SYSTEM_FONTS + ":" + GUEST_SYSTEM_FONTS);
|
||||
}
|
||||
}
|
||||
|
||||
private static void bind(List<String> cmd, String spec) {
|
||||
cmd.add("-b");
|
||||
cmd.add(spec);
|
||||
|
||||
Reference in new issue
Block a user