diff options
author | ltlnx <ltlnx@gmx.com> | 2023-05-18 23:11:26 +0100 |
---|---|---|
committer | Willy Sudiarto Raharjo <willysr@slackbuilds.org> | 2023-05-20 11:17:11 +0700 |
commit | 9c48e9ab5d51a6cfb3d1dcc4d3335e93a2258a9e (patch) | |
tree | 00d16a2beb3a5a306d1c6de399b9a0192e064564 /system/CNS11643-font | |
parent | c8385de8f9c551d5a97fea87605c254deb0667c6 (diff) |
system/CNS11643-font: Modify configs and README.
Signed-off-by: bedlam <dave@slackbuilds.org>
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
Diffstat (limited to 'system/CNS11643-font')
-rw-r--r-- | system/CNS11643-font/35-CNS11643-font-patches.conf | 101 | ||||
-rw-r--r-- | system/CNS11643-font/98-CNS11643-font-patches.conf | 21 | ||||
-rw-r--r-- | system/CNS11643-font/CNS11643-font.SlackBuild | 22 | ||||
-rw-r--r-- | system/CNS11643-font/README | 28 | ||||
-rw-r--r-- | system/CNS11643-font/doinst.sh | 2 |
5 files changed, 129 insertions, 45 deletions
diff --git a/system/CNS11643-font/35-CNS11643-font-patches.conf b/system/CNS11643-font/35-CNS11643-font-patches.conf new file mode 100644 index 000000000000..55b0af8cd6c5 --- /dev/null +++ b/system/CNS11643-font/35-CNS11643-font-patches.conf @@ -0,0 +1,101 @@ +<?xml version="1.0"?> +<!DOCTYPE fontconfig SYSTEM "fonts.dtd"> +<!-- Patch file to make sure default fonts don't get replaced--> +<fontconfig> + <match target="font"> + <test name="lang" compare="contains"> + <string>zh_TW</string> + </test> + <alias> + <family>sans-serif</family> + <prefer> + <family>{{SANS_FONT}}</family> + <family>Noto Sans CJK TC</family> + </prefer> + </alias> + </match> + <match target="font"> + <test name="lang" compare="contains"> + <string>zh_TW</string> + </test> + <alias> + <family>monospace</family> + <prefer> + <family>{{MONOSPACE_FONT}}</family> + <family>Noto Sans CJK TC</family> + </prefer> + </alias> + </match> + <match target="font"> + <test name="lang" compare="contains"> + <string>zh_CN</string> + </test> + <alias> + <family>sans-serif</family> + <prefer> + <family>{{SANS_FONT}}</family> + <family>Noto Sans CJK SC</family> + </prefer> + </alias> + </match> + <match target="font"> + <test name="lang" compare="contains"> + <string>zh_CN</string> + </test> + <alias> + <family>monospace</family> + <prefer> + <family>{{MONOSPACE_FONT}}</family> + <family>Noto Sans CJK SC</family> + </prefer> + </alias> + </match> + <match target="font"> + <test name="lang" compare="contains"> + <string>ja</string> + </test> + <alias> + <family>sans-serif</family> + <prefer> + <family>{{SANS_FONT}}</family> + <family>Noto Sans CJK JP</family> + </prefer> + </alias> + </match> + <match target="font"> + <test name="lang" compare="contains"> + <string>ja</string> + </test> + <alias> + <family>monospace</family> + <prefer> + <family>{{MONOSPACE_FONT}}</family> + <family>Noto Sans CJK JP</family> + </prefer> + </alias> + </match> + <match target="font"> + <test name="lang" compare="contains"> + <string>ko</string> + </test> + <alias> + <family>sans-serif</family> + <prefer> + <family>{{SANS_FONT}}</family> + <family>Noto Sans CJK KR</family> + </prefer> + </alias> + </match> + <match target="font"> + <test name="lang" compare="contains"> + <string>ko</string> + </test> + <alias> + <family>monospace</family> + <prefer> + <family>{{MONOSPACE_FONT}}</family> + <family>Noto Sans CJK KR</family> + </prefer> + </alias> + </match> +</fontconfig> diff --git a/system/CNS11643-font/98-CNS11643-font-patches.conf b/system/CNS11643-font/98-CNS11643-font-patches.conf deleted file mode 100644 index c123a241e5e3..000000000000 --- a/system/CNS11643-font/98-CNS11643-font-patches.conf +++ /dev/null @@ -1,21 +0,0 @@ -<?xml version="1.0"?> -<!DOCTYPE fontconfig SYSTEM "fonts.dtd"> -<!-- Patch file to make sure default fonts don't get replaced--> -<fontconfig> - <match target="pattern"> - <test qual="any" name="family"> - <string>sans-serif</string> - </test> - <edit name="family" mode="prepend" binding="strong"> - <string>{{DEFAULT_FONT}}</string> - </edit> - </match> - <match target="pattern"> - <test qual="any" name="family"> - <string>sans-serif</string> - </test> - <edit name="family" mode="prepend" binding="strong"> - <string>Noto Sans CJK {{FONTLANG}}</string> - </edit> - </match> -</fontconfig> diff --git a/system/CNS11643-font/CNS11643-font.SlackBuild b/system/CNS11643-font/CNS11643-font.SlackBuild index ea0109919a34..843a84c0c21e 100644 --- a/system/CNS11643-font/CNS11643-font.SlackBuild +++ b/system/CNS11643-font/CNS11643-font.SlackBuild @@ -28,7 +28,7 @@ cd $(dirname $0) ; CWD=$(pwd) PRGNAM=CNS11643-font VERSION=${VERSION:-20230323} SRCNAM=Open_Data -BUILD=${BUILD:-1} +BUILD=${BUILD:-2} TAG=${TAG:-_SBo} PKGTYPE=${PKGTYPE:-tgz} @@ -62,23 +62,21 @@ find -L . \ mkdir -p $PKG/usr/share/fonts/TTF cp -a Open_Data/Fonts/*.ttf $PKG/usr/share/fonts/TTF -# Patch the fontconfig file to include accurate info from the system. -if FONTLANG="$(echo $LANG | grep -Po '{JP|KR|TW|HK|CN}')"; then - FONTLANG="$(echo $FONTLANG | sed 's|TW|TC|;s|CN|SC|')" -else - FONTLANG="TC" +# Add config for Noto Fonts if the user asks for it. +NOTOPATCH=${NOTOPATCH:-no} +if [ "$NOTOPATCH" = "yes" ]; then + mkdir -p $PKG/etc/fonts/conf.{d,avail} + cat $CWD/35-CNS11643-font-patches.conf | sed "s|{{SANS_FONT}}|$(fc-match -f "%{family[0]}" sans-serif)|g; s|{{MONOSPACE_FONT}}|$(fc-match -f "%{family[0]}" monospace)|g" > $PKG/etc/fonts/conf.avail/35-CNS11643-font-patches.conf + ( cd $PKG/etc/fonts/conf.d && \ + ln -sf ../conf.avail/35-CNS11643-font-patches.conf + ) fi -mkdir -p $PKG/etc/fonts/conf.{d,avail} -cat $CWD/98-CNS11643-font-patches.conf | sed "s|{{DEFAULT_FONT}}|$(fc-match -f "%{family[0]}")|; s|{{FONTLANG}}|$FONTLANG|" > $PKG/etc/fonts/conf.avail/98-CNS11643-font-patches.conf -( cd $PKG/etc/fonts/conf.d && \ - ln -sf ../conf.avail/98-CNS11643-font-patches.conf -) # Create a font config file and symlink it into /etc/fonts/conf.d. # Do this only if the user explicitly asks for it. ADDCONF=${ADDCONF:-no} - if [ "$ADDCONF" = "yes" ]; then + mkdir -p $PKG/etc/fonts/conf.{d,avail} cat $CWD/99-CNS11643-font.conf > $PKG/etc/fonts/conf.avail/99-CNS11643-font.conf ( cd $PKG/etc/fonts/conf.d && \ ln -sf ../conf.avail/99-CNS11643-font.conf diff --git a/system/CNS11643-font/README b/system/CNS11643-font/README index 8ecdb2b23584..696a424d7401 100644 --- a/system/CNS11643-font/README +++ b/system/CNS11643-font/README @@ -2,24 +2,30 @@ This package contains two type of fonts: TW-Kai and TW-Sung, which are provided by CNS11643 Chinese Standard Interchange Code Master Ideographs from Taiwan. -Included is a config file that adds the Noto Sans CJK family to a higher -spot in the default "sans-serif" substitutes. If you're using a -graphical desktop environment, this would make sure that your default -Chinese font substitute, Noto Sans CJK, wouldn't be superseded by the -fonts installed by this package. If your default fonts are changed after -installing this package, please email me at ltlnx (at) gmx (dot) com. +Two config files are available in this SlackBuild package: one is a +config file that adds the Noto Sans CJK family to a higher spot in +"sans-serif" substitutes for supported languages (Chinese, Japanese, +Korean). You would want to enable this if you're using a desktop +environment that has Noto Sans CJK as the default fallback, otherwise +the fallback font would be replaced. + +To enable this config, add the environment variable "NOTOPATCH=yes" in +front of the SlackBuild command, and run it as such: + + NOTOPATCH=yes ./CNS11643-font.SlackBuild + +If you're using a SlackBuild manager, the way of adding variables may +differ; please consult the manual of your program for instructions. Another config file is included, 35-CNS11643-font.conf, that binds the Windows counterparts "MingLiU" (細明體) and "PMingLiU" (新細明體) to TW-Sung, and "DFKai-SB", "UKai" (標楷體) to TW-Kai. If you want it copied into /etc/fonts/conf.avail, add the -environment variable "ADDCONF=yes" at the front of the SlackBuild, -and run it as such: +environment variable "ADDCONF=yes" in front of the SlackBuild. - ADDCONF=yes ./CNS11643-font.SlackBuild +Therefore I recommend running the SlackBuild like this: -If you're using a SlackBuild manager, the way of adding variables may -differ; please consult the manual of your program for instructions. + ADDCONF=yes NOTOPATCH=yes ./CNS11643-font.SlackBuild The source file can be found at "http://data.gov.tw/node/5961", and the license can be found at "http://www.cns11643.gov.tw/AIDB/copyright.do". diff --git a/system/CNS11643-font/doinst.sh b/system/CNS11643-font/doinst.sh index 883c47ac0a60..b3ec374e4a45 100644 --- a/system/CNS11643-font/doinst.sh +++ b/system/CNS11643-font/doinst.sh @@ -1,6 +1,6 @@ # Update the X font indexes: if [ -x /usr/bin/mkfontdir ]; then - ( cd /usr/share/fonts/TTF + ( cd usr/share/fonts/TTF mkfontscale . mkfontdir . ) |