哦!原来是这样用啊!感谢!
这个bug好像修复了, https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=81fd380dea4d4e66d2a93b708caa0e2a9c79de4a
没留意这个
我现在改用ipad跑emacs23,很多扩展都不兼容了,老哥的pyim也用不了,改回eim了
不过也有所得,emacs-w3m跑不了,找到一个nero.el,可以把lynx集成进去,cjk显示勉强可用
自己写了重命名字体文件及样式名称的 shell 脚本
使用方法:
首先安装 fonttools
比如 debian:
sudo apt install fonttools
然后复制下面代码,保存为 sh 脚本
比如保存为 rffn.sh
#!/usr/bin/env bash
#
# Script Name : rffn.sh
# By : blove
# Creation Date : 2021.09.15
# Use : ./rffn.sh font_name new_name
# Exp : ./rffn.sh FontName.ttf NewFamilyName
#
if [ $# -eq 2 ];then
# === var dec.
fn="${1%.*}"
fext="${1##*.}"
ttxf="${1%.*}".ttx
rmttxf="${1%.*}".ttx*
outf="$2.$fext"
addstyle="\ \ \ \ \ \ Regular"
addfn="\ \ \ \ \ \ $2"
#=== rm ttx file
if [ -f $ttxf ];then
rm $rmttxf
fi
# === ext-p
if [ $fext == "ttf" ] || [ $fext == "otf" ];then
# === fontfile exist-p
if [ -f $1 ];then
ttx $1
else
echo "File not found : $1"
fi
# === ttxfile exist-p
if [ -f $ttxf ];then
# === eng-font-family-name exist-p
familyline=`sed -n '/<namerecord nameID=\"1\".*.langID=\"0x409\"/=' $ttxf | awk '$1=$1'`
# === if eng-font-family-name does not exist
if [ "$familyline" == '' ];then
enfadd='\ \ \ \ <namerecord nameID="1" platformID="3" platEncID="1" langID="0x409">'
ensadd='\ \ \ \ <namerecord nameID="2" platformID="3" platEncID="1" langID="0x409">'
tagadd='\ \ \ \ <\/namerecord>'
sed -i "/<\/name>/i $enfadd" $ttxf
sed -i "/<\/name>/i $addfn" $ttxf
sed -i "/<\/name>/i $tagadd" $ttxf
sed -i "/<\/name>/i $ensadd" $ttxf
sed -i "/<\/name>/i $addstyle" $ttxf
sed -i "/<\/name>/i $tagadd" $ttxf
# === if eng-font-family-name exists
elif [ "$familyline" != '' ];then
# === replace original family-name with $2
flline=$((familyline+1))
# --- way1 replace,bug,not use
# flstr=`sed -n "${flline}p" $ttxf | awk '$1=$1'`
# sed -i "${flline}s/${flstr}/$2/" $ttxf
# --- way2 del the line of family name & add new line with new name
sed -i "${flline}d" $ttxf
sed -i "/<namerecord nameID=\"1\".*.langID=\"0x409\"/a $addfn" $ttxf
echo "The family name is \"$2\" now."
# === fontstyle-p
styleline=`sed -n '/<namerecord nameID=\"2\".*.langID=\"0x409\"/=' $ttxf | awk '$1=$1'`
if [ "$styleline" != '' ];then
stline=$((styleline+1))
ststr=`sed -n "${stline}p" $ttxf | awk '$1=$1'`
# === font-style-name-p
if [ "$ststr" != "Regular" ];then
sed -i "${stline}s/${ststr}/Regular/" $ttxf
echo "The font style is Regular now."
fi
fi
fi
# === rebuild font.ttf or font.otf
ttx -o $outf $ttxf
# === remove ttx file
rm $rmttxf
fi
else
echo "file not allow..."
fi
else
echo "use: ./rffn.sh font_name.ext new_name"
echo
echo "exp: ./rffn.sh font.ttf new_name"
fi
将 ttf 或 otf (目前只支持这两种格式)字体文件与该脚本同目录内
./rffn.sh font.ttf NewName
一条命令修改字体 Family Name 和字体样式为 Regular
1 个赞
对于shell脚本了解的不是太多,也没有太多时间做更多测试,希望大家发现问题帮忙纠正。