diff --git a/bin/omarchy-cn-font-apply b/bin/omarchy-cn-font-apply new file mode 100755 index 00000000..098b1b88 --- /dev/null +++ b/bin/omarchy-cn-font-apply @@ -0,0 +1,15 @@ +#!/bin/bash +# omarchy:summary=Install CJK fonts and the OmarchyCN fontconfig priority +# omarchy:examples=omarchycn font apply + +set -euo pipefail + +omarchy-pkg-add noto-fonts-cjk noto-fonts-emoji + +conf_dir="$HOME/.config/fontconfig/conf.d" +mkdir -p "$conf_dir" +cp "$OMARCHY_PATH/cn/fontconfig/64-omarchycn-cjk.conf" "$conf_dir/" +fc-cache -f > /dev/null + +echo "CJK fonts installed, fontconfig priority applied ($conf_dir/64-omarchycn-cjk.conf)" +omarchy-cn-font-status diff --git a/bin/omarchy-cn-font-status b/bin/omarchy-cn-font-status new file mode 100755 index 00000000..e51a0c91 --- /dev/null +++ b/bin/omarchy-cn-font-status @@ -0,0 +1,27 @@ +#!/bin/bash +# omarchy:summary=Check Chinese font availability and fallback correctness +# omarchy:examples=omarchycn font status + +set -euo pipefail + +failures=0 + +for family in "Noto Sans CJK SC" "Noto Serif CJK SC" "Noto Sans Mono CJK SC"; do + matched=$(fc-match --format '%{family}' "$family") + if [[ $matched == *"$family"* ]]; then + echo "PASS font: $family" + else + echo "FAIL font: $family missing (got: $matched)" + failures=$((failures + 1)) + fi +done + +zh_sans=$(fc-match --format '%{family}' sans-serif:lang=zh-cn) +if [[ $zh_sans == *"CJK SC"* ]]; then + echo "PASS fallback: zh-cn sans-serif -> $zh_sans" +else + echo "FAIL fallback: zh-cn sans-serif -> $zh_sans (expected SC variant)" + failures=$((failures + 1)) +fi + +exit $((failures > 0 ? 1 : 0)) diff --git a/bin/omarchy-cn-locale-apply b/bin/omarchy-cn-locale-apply new file mode 100755 index 00000000..b51d28f3 --- /dev/null +++ b/bin/omarchy-cn-locale-apply @@ -0,0 +1,15 @@ +#!/bin/bash +# omarchy:summary=Generate zh_CN.UTF-8 and en_US.UTF-8 locales +# omarchy:examples=omarchycn locale apply +# omarchy:requires-sudo=true + +set -euo pipefail + +for loc in "zh_CN.UTF-8 UTF-8" "en_US.UTF-8 UTF-8"; do + if ! grep -qE "^${loc% *}" /etc/locale.gen; then + echo "$loc" | sudo tee -a /etc/locale.gen > /dev/null + fi +done + +sudo locale-gen +echo "Locales available: $(locale -a | grep -cE 'zh_CN|en_US') (zh_CN/en_US variants)" diff --git a/cn/fontconfig/64-omarchycn-cjk.conf b/cn/fontconfig/64-omarchycn-cjk.conf new file mode 100644 index 00000000..195674fb --- /dev/null +++ b/cn/fontconfig/64-omarchycn-cjk.conf @@ -0,0 +1,43 @@ + + + + + + zh-cn + sans-serif + Noto Sans CJK SC + + + zh-cn + serif + Noto Serif CJK SC + + + zh-cn + monospace + Noto Sans Mono CJK SC + + + sans-serif + + Noto Sans + Noto Sans CJK SC + Noto Color Emoji + + + + serif + + Noto Serif + Noto Serif CJK SC + Noto Color Emoji + + + + monospace + + Noto Sans Mono CJK SC + Noto Color Emoji + + +