บันทึกเทคนิคของ zhaoJian

CachyOS ตั้งค่าฟอนต์ทั้งระบบ แก้ปัญหาฟอนต์บางโปรแกรมน่าเกลียดไม่สม่ำเสมอ

เทคโนโลยี ~2913 คำ · อ่าน 8 นาที - ครั้งที่อ่าน

CachyOS ครองอันดับ 1 บน DistroWatch ติดต่อกัน 12 เดือนแล้ว เคยได้ยินมาก่อนว่าระบบนี้เร็วมาก แต่แค่ติดตั้งดู ไม่ได้ใช้งานจริงจัง เพราะฟอนต์หลังติดตั้งระบบเสร็จน่าเกลียดมาก เลยยกเลิกไปเลย เมื่อเร็วๆ นี้มีเวลาก็ติดตั้งอีกครั้ง ความเร็วเร็วจริงๆ รู้สึกได้จากการใช้งานประจำวัน แต่หลังจากตั้งค่าฟอนต์แล้ว ยังมีบางโปรแกรมที่ฟอนต์ไม่สม่ำเสมอ น่าเกลียดมาก หลังจากลองแก้ไขไฟล์กำหนดค่าฟอนต์ผู้ใช้ด้วยวิธีด้านล่าง ก็สม่ำเสมอแล้ว

แก้ไขการกำหนดค่า fontconfig แก้ไขไฟล์กำหนดค่าฟอนต์ผู้ใช้

nano ~/.config/fontconfig/fonts.conf

ใช้เนื้อหาด้านล่างแทนที่เนื้อหาไฟล์กำหนดค่าเดิม

<?xml version='1.0'?>
<!DOCTYPE fontconfig SYSTEM 'urn:fontconfig:fonts.dtd'>
<fontconfig>
<!-- Artificial oblique for fonts without an italic or oblique version -->
<match target="font">
<!-- check to see if the font is roman -->
<test name="slant">
<const>roman</const>
</test>
<!-- check to see if the pattern requested non-roman -->
<test compare="not_eq" name="slant" target="pattern">
<const>roman</const>
</test>
<!-- multiply the matrix to slant the font -->
<edit mode="assign" name="matrix">
<times>
<name>matrix</name>
<matrix>
<double>1</double>
<double>0.2</double>
<double>0</double>
<double>1</double>
</matrix>
</times>
</edit>
<!-- pretend the font is oblique now -->
<edit mode="assign" name="slant">
<const>oblique</const>
</edit>
<!-- and disable embedded bitmaps for artificial oblique -->
<edit mode="assign" name="embeddedbitmap">
<bool>false</bool>
</edit>
</match>
<!-- Synthetic emboldening for fonts that do not have bold face available -->
<match target="font">
<!-- check to see if the weight in the font is less than medium which possibly need emboldening -->
<test compare="less_eq" name="weight">
<const>medium</const>
</test>
<!-- check to see if the pattern requests bold -->
<test compare="more_eq" name="weight" target="pattern">
<const>bold</const>
</test>
<!-- set the embolden flag needed for applications using cairo, e.g. gucharmap, gedit, ... -->
<edit mode="assign" name="embolden">
<bool>true</bool>
</edit>
<!-- set weight to bold needed for applications using Xft directly, e.g. Firefox, ... -->
<edit mode="assign" name="weight">
<const>bold</const>
</edit>
</match>
<!-- เพิ่มส่วนนี้: ตั้งค่าลำดับความสำคัญของตระกูลฟอนต์ -->
<alias>
<family>sans-serif</family>
<prefer>
<family>Noto Sans CJK SC</family>
</prefer>
</alias>
<alias>
<family>serif</family>
<prefer>
<family>Noto Serif CJK SC</family>
</prefer>
</alias>
<alias>
<family>monospace</family>
<prefer>
<family>Noto Sans Mono CJK SC</family>
</prefer>
</alias>
</fontconfig>

รีเฟรชแคชฟอนต์

fc-cache -fv
แชร์:

ความคิดเห็น