让雅黑在linux下更完美

(液晶显示器)我的arch linux字体采用DejaVu +微软雅黑,默认状态下,DejaVu的英文显示非常完美,笔画细腻清晰,但是雅黑就不怎么好,脏兮兮的而且不够锐利。但是开了整体hinting和次像素渲染后却影响了DejaVu。
解决方法:在/etc/fonts/local.conf(无则创建)添加以下内容,只针对雅黑打开hinting和次像素:
     < ! --Hinting for Microsoft Yahei-- >
     < match target ="font" >
   < test name ="family" >
       < string >Microsoft Yahei </string>
   </test>
   < edit name ="autohint" mode ="assign" >
           < bool >false </bool>
           </edit>
         < edit name ="hinting" mode ="assign" >
               < bool >true </bool>
         </edit>
         < edit name ="hintstyle" mode ="assign" >
               < const >hintfull </const>
         </edit>
   < edit name ="rgba" mode ="assign" >
       < const >rgb </const>
   </edit>
     </match>


效果如图.


附上我完整的/etc/fonts/local.conf

< ?xml version ="1.0"? >
< !DOCTYPE fontconfig SYSTEM "fonts.dtd" >
< ! -- /etc/fonts/local.conf file for local customizations -- >
< fontconfig >


     < ! --Hinting for Microsoft Yahei-- >
     < match target ="font" >
   < test name ="family" >
       < string >Microsoft Yahei </string>
   </test>
   < edit name ="autohint" mode ="assign" >
           < bool >false </bool>
           </edit>
         < edit name ="hinting" mode ="assign" >
               < bool >true </bool>
         </edit>
         < edit name ="hintstyle" mode ="assign" >
               < const >hintfull </const>
         </edit>
   < edit name ="rgba" mode ="assign" >
       < const >rgb </const>
   </edit>
     </match>


    
     < ! -- Disable font alias for Chinese 9-20-- >
< match target ="font" >
   < test qual ="any" name ="family" compare ="eq" >
       < string >SimSun </string>
       < string >Tahoma </string>
   </test>
     < test name ="pixelsize" compare ="more_eq" > < double >9 </double> </test>
     < test name ="pixelsize" compare ="less_eq" > < double >20 </double> </test>
     < edit name ="antialias" > < bool >false </bool> </edit>
   </match>

   < ! -- Set prefer font for font family -- >
     < match target ="pattern" >
     < test qual ="any" name ="family" >
       < string >serif </string>
     </test>
     < edit name ="family" mode ="append" binding ="strong" >
     < string >DejaVu Serif </string>
     < string >Microsoft Yahei </string>
     < string >SimSun </string>
     </edit>
   </match>

   < match target ="pattern" >
     < test qual ="any" name ="family" >
       < string >sans-serif </string>
     </test>
     < edit name ="family" mode ="append" binding ="strong" >
     < string >DejaVu Sans </string>
     < string >Microsoft Yahei </string>
     < string >SimSun </string>
     </edit>
   </match>

   < match target ="pattern" >
     < test qual ="any" name ="family" >
       < string >monospace </string>
     </test>
     < edit name ="family" mode ="append" binding ="strong" >
     < string >DejaVu Sans Mono </string>
     < string >Microsoft Yahei </string>
     < string >SimSun </string>
     </edit>
   </match>

   < alias >
       < family >serif </family>
           < prefer >
   < family >DejaVu Serif </family>
   < family >Microsoft Yahei </family>
   < family >SimSun </family>
   </prefer>
   </alias>
  
   < alias >
       < family >sans-serif </family>
       < prefer >
   < family >DejaVu Sans </family>
   < family >Microsoft Yahei </family>
   < family >SimSun </family>
         </prefer>
   </alias>

   < alias >
           < family >monospace </family>
       < prefer >
   < family >DejaVu Sans Mono </family>
   < family >Microsoft Yahei </family>
   < family >SimSun </family>
       </prefer>
   </alias>

</fontconfig>

你可能感兴趣的:(linux,职场,休闲)