From 794cb30a21197db3eeff34121b1fd9ea6a03cda3 Mon Sep 17 00:00:00 2001 From: Melorise <0d00@0721.hk> Date: Wed, 21 Oct 2026 01:07:50 +0800 Subject: [PATCH] fix Chinese --- README.md | 2 ++ package.nix | 26 ++++++++++++++++++++++---- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index e9d018d..6450899 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,8 @@ Tuanjie Hub 1.4.7,重打包自deb包 使用 FHS 环境运行 Hub 及其安装的编辑器,包含 nixpkgs Unity Hub 打包所列的编辑器、授权服务、Bug Reporter、字体和辅助工具依赖。`libxml2_13` 提供编辑器需要的 `libxml2.so.2`。 +Hub 及其启动的编辑器通过独立的 `FONTCONFIG_FILE` 使用静态版 Noto Sans CJK、Core Fonts、DejaVu 和 Liberation 字体,为编辑器内部中文界面提供字体回退。更新软件包后,关闭编辑器和 Hub,再通过 `nix run` 启动。 + ## 使用 ```sh diff --git a/package.nix b/package.nix index 5b7672f..d1bb39f 100644 --- a/package.nix +++ b/package.nix @@ -3,11 +3,28 @@ stdenvNoCC, libarchive, buildFHSEnv, + makeFontsConf, + fontconfig, + noto-fonts-cjk-sans, + corefonts, + dejavu_fonts, + liberation_ttf, src, }: let version = "1.4.7"; + editorFonts = [ + (noto-fonts-cjk-sans.override { static = true; }) + corefonts + dejavu_fonts + liberation_ttf + ]; + fontsConf = makeFontsConf { + fontDirectories = editorFonts; + impureFontDirectories = [ ]; + includes = [ "${fontconfig.out}/etc/fonts/conf.d" ]; + }; unpacked = stdenvNoCC.mkDerivation { pname = "tuanjiehub-unpacked"; inherit version src; @@ -40,7 +57,7 @@ buildFHSEnv { fontconfig freetype lsb-release - ]; + ] ++ editorFonts; multiPkgs = pkgs: with pkgs; [ @@ -99,9 +116,6 @@ buildFHSEnv { vulkan-loader libice libsm - corefonts - dejavu_fonts - liberation_ttf ]; extraBuildCommands = '' @@ -112,6 +126,10 @@ buildFHSEnv { runScript = "/opt/tuanjiehub/tuanjiehub"; + profile = '' + export FONTCONFIG_FILE="${fontsConf}" + ''; + extraInstallCommands = '' mkdir -p "$out/share" cp -a "${unpacked}/usr/share/". "$out/share/"