Ubuntu 22.04 设置系统字体平滑

1、 修改该配置文件,没有就创建一个。

sudo vim  /etc/fonts/conf.d/10-scale-bitmap-fonts.conf

如果有配置文件及内容的只需要粘贴框中的即可,如果没有就直接粘贴进去。

2、粘贴配置内容, 默认有配置文件的只复制注释部分即可。

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
  <its:rules xmlns:its="http://www.w3.org/2005/11/its" version="1.0">
    <its:translateRule translate="no" selector="/fontconfig/*[not(self::description)]"/>
  </its:rules>

  <description>Bitmap scaling</description>
<!--
  If font is bitmap, calculate scale factor.
  Note that color bitmap fonts have scalable=true, while
  non-color ones have scalable=false.  Both groups have outline=false.
  -->
<match target="font">
  <test name="outline" compare="eq">
    <bool>false</bool>
  </test>
  <edit name="pixelsizefixupfactor" mode="assign">
    <divide>
      <name target="pattern">pixelsize</name>
      <name target="font"   >pixelsize</name>
    </divide>
  </edit>
</match>
<!--
  For non-scalable bitmap fonts (ie. non-color), skip
  minor scaling if hinting is enabled.
  -->
<match target="font">
  <test name="outline" compare="eq">
    <bool>false</bool>
  </test>
  <test name="scalable" compare="eq">
    <bool>false</bool>
  </test>
  <test name="hinting" compare="eq">
    <bool>true</bool>
  </test>
  <edit name="scalingnotneeded" mode="assign">
    <and>
      <less>
        <name>pixelsizefixupfactor</name>
        <double>1.2</double>
      </less>
      <more>
        <name>pixelsizefixupfactor</name>
        <double>0.8</double>
      </more>
    </and>
  </edit>
</match>
<match target="font">
  <test name="scalingnotneeded" compare="eq">
    <bool>true</bool>
  </test>
  <edit name="pixelsizefixupfactor" mode="assign">
    <double>1.0</double>
  </edit>
</match>
<!--
  If we *are* going to scale, go ahead and do it.
  -->
<match target="font">
  <test name="outline" compare="eq">
    <bool>false</bool>
  </test>
  <test name="pixelsizefixupfactor" compare="not_eq">
    <double>1.0</double>
  </test>
  <edit name="matrix" mode="assign">
    <times>
      <name>matrix</name>
      <matrix>
        <name>pixelsizefixupfactor</name> <double>0</double>
        <double>0</double> <name>pixelsizefixupfactor</name>
       </matrix>
    </times>
  </edit>
  <edit name="size" mode="assign">
    <divide>
      <name>size</name>
      <name>pixelsizefixupfactor</name>
    </divide>
  </edit>
</match>

  <!-- 启用RGBA渲染 -->
  <match target="pattern">
    <edit name="rgba" mode="assign">
      <const>rgb</const>
    </edit>
  </match>


  <!-- LCD滤波器选择 -->
  <match target="pattern">
    <edit name="lcdfilter" mode="assign">
      <const>lcddefault</const>
    </edit>
  </match>

  <!-- Cleartype字体渲染 -->
  <match target="pattern">
    <edit name="hinting" mode="assign">
      <bool>true</bool>
    </edit>
    <edit name="hintstyle" mode="assign">
      <const>hintslight</const>
    </edit>
  </match>

  <!-- 字体抗锯齿设置 -->
  <match target="pattern">
    <edit name="antialias" mode="assign">
      <bool>true</bool>
    </edit>
    <edit name="autohint" mode="assign">
      <bool>false</bool>
    </edit>
  </match>


</fontconfig>

:wq 保存

3、 执行下面命令更新配置

sudo fc-cache -f

  更新完后直接重启或者执行下面的命令即可。

xset +fp /usr/share/fonts/truetype/ttf-dejavu


 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值