Archlinux下安装雅黑字体

本文介绍了在ArchLinux系统中如何替换软件包并安装雅黑字体的详细步骤,包括删除特定软件包,用Ubuntu版本替换,下载字体文件,更新字体目录,配置X11和创建字体缓存,最终实现浏览器中显示效果。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1. 删除cairo、fontconfig、freetype2、libxft四个软件包:

sudo pacman -Rd cairo fontconfig freetype2 libxft

用ubuntu版的cairo、fontconfig、freetype2、libxft替换之,这四个软件的ARU链接为:

cairo-ubuntu

fontconfig-ubuntu

freetype2-ubuntu

libxft-ubuntu

分别下载四个软件对应的PKGBUILD和相关文件,使用makepkg命令构建软件包,然后

sudo pacman -U ***.pkg.tar.gz

安装软件包

 

2. 下载雅黑字体,有两个文件myth.ttf和mythbd.ttf, 复制到/usr/share/fonts/vista,然后在该目录下执行:

sudo mkfontdir

sudo mkfontscale

并在 /etc/X11/xorg.conf 里加入一行:

FontPath “/usr/share/fonts/vista”

最后创建字体缓存 :

fc-cache -fv

 

3. 编辑/etc/fonts/local.conf文件,把全部内容替换为:

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">

<!-- /etc/fonts/local.conf file to configure system-wide font access -->
<fontconfig>
        <!--
        Target dots per inch.
        Uncomment following block and change 96 to your LCD or CRT actual dpi
        -->
        <match target="pattern" >
                <edit name="dpi" mode="assign" >
                        <double>90</double>
                </edit>
        </match>

        <!--  
        Enable LCD sub-pixel rendering.

        Pay attention, subpixel rendering is exploited only on LCD not CRT.
        Enable it will add some color fringing on the edge of font.It is not 
        always a bad thing,please sit away from your screen further enough 
        untill you can't observe the fringing.

        Some people's LCD subpixel layout that is not rgb order will get
        opposite result,there are four patterns horizontal rgb/bgr and 
        vertical rgb/bgr, but horizontal rgb is the most common.
        Change rgb -> yours.

        If you are using CRT, you may benefit from it.

        If it disturb you or you prefer to the normal grayscale antialiasing, 
        change rgb -> none and you should also disable it for each place it 
        appear. 

        If you are using LCD, i recommand you enable it, or you can't enjoy ClearType-like
        looking.
        -->
        <match target="font" >
                <edit name="rgba" mode="assign" >
                        <const>rgb</const>
                </edit>
        </match>

        <!--
        Default Fonts setting for those free fonts that probably have been existed 
        in your system, e.g. ttf-bitstream-vera and ttf-dejavu etc.
        MS Vista fonts will not use this setting. 
        -->
        <match target="font" >
                <edit name="antialias" mode="assign" >
                        <bool>true</bool>
                </edit>
                <edit name="autohint" mode="assign" >
                        <bool>true</bool>
                </edit>
                <edit name="hinting" mode="assign" >
                        <bool>false</bool>
                </edit>
                <edit name="hintstyle" mode="assign" >
                        <const>hintslight</const>
                </edit>
        </match>

        <!--
        Mark common families with their generics so we'll get
        something reasonable
        -->
        <!--
        Sans-serif faces
        -->
        <alias>
                <family>Segoe UI</family>
                <family>Calibri</family>
                <family>Candara</family>
                <family>Corbel</family>

                <!-- vista new Simplified Chinese font --> 
                <family>Microsoft YaHei</family>
                <family>微软雅黑</family>

                <!-- vista new Tranditonal Chinese font -->
                <family>Microsoft JhengHei</family>
                <family>微軟正黑體</family>

                <!-- vista new Japanese font -->
                <family>Meiryo</family>

                <!-- vista new Korean font -->
                <family>Malgun Gothic</family>
        </alias>

        <!--
        Serif faces
        -->
        <alias>
                <family>Cambria</family>
                <family>Constantina</family>

                <family>SimSunNew</family>
                <family>宋体New</family>
                <family>PMingLiUNew</family>
                <family>新細明體New</family>
                <default>
                        <family>serif</family>
                </default>
        </alias>

        <!--
        Monospace faces
        -->
        <alias>
                <family>Consolas</family>
                <family>Courier New</family>
                <default>
                        <family>monospace</family>
                </default>
        </alias>

        <!--
        Provide required aliases for standard names
        -->
        <alias>
                <family>sans-serif</family>
                <prefer>
                        <family>Segoe UI</family>
                        <family>Calibri</family>			
                        <family>Candara</family>
                        <family>Corbel</family>
                        <family>Microsoft YaHei</family>
                        <family>微软雅黑</family>
                        <family>Microsoft JhengHei</family>
                        <family>微軟正黑體</family>
                        <family>Meiryo</family>
                        <family>Malgun Gothic</family>
                        <family>NSimSunNew</family>
                        <family>宋体New</family>
                        <family>PMingLiUNew</family>
                        <family>新細明體New</family>
                </prefer>
        </alias>
        <alias>
                <family>serif</family>
                <prefer>
                        <family>Cambria</family>	
                        <family>Constantia</family>		
                        <family>Microsoft YaHei</family>
                        <family>微软雅黑</family>
                        <family>Microsoft JhengHei</family>
                        <family>微軟正黑體</family>
                        <family>Meiryo</family>
                        <family>Malgun Gothic</family>
                        <family>NSimSunNew</family>
                        <family>宋体New</family>
                        <family>PMingLiUNew</family>
                        <family>新細明體New</family>
                </prefer>
        </alias>
        <alias>
                <family>monospace</family>
                <prefer>
                        <family>Consolas</family>
                        <family>Microsoft YaHei</family>
                        <family>微软雅黑</family>
                        <family>Microsoft JhengHei</family>
                        <family>微軟正黑體</family>
                        <family>Courier New</family>
                        <family>NSimSunNew</family>
                        <family>宋体New</family>
                        <family>PMingLiUNew</family>
                        <family>新細明體New</family>
                </prefer>
        </alias>

        <!--
        Load MS core fonts customization file
        -->
        <include ignore_missing="yes">./ms_vista_english.conf</include>

        <!--
        Load CJK Asian fonts customization file
        -->
        <include ignore_missing="yes">./ms_vista_cjk.conf</include>

        <!--
        Synthetic emboldening for fonts that do not have bold face available
        -->
        <match target="font" >
                <!-- check to see if the font is just regular -->
                <test name="weight" compare="less_eq">
                        <const>medium</const>
                </test>
                <!-- check to see if the pattern requests bold -->
                <test target="pattern" name="weight" compare="more">
                        <const>medium</const>
                </test>
                <!--
                set the embolden flag
                needed for applications using cairo, e.g. gucharmap, gedit, ...
                -->
                <edit name="embolden" mode="assign" >
                        <bool>true</bool>
                </edit>
                <!--
                set weight to bold
                needed for applications using Xft directly, e.g. Firefox, ...
                -->
                <edit name="weight" mode="assign">
                        <const>bold</const>
                </edit>
        </match>
</fontconfig>

 保存,最后重启X,完毕。贴几张图看看效果。

JavaEye在firefox下的效果:

 网易163在firefox下的效果:

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值