29 ธันวาคม 2551

แก้ไขปัญหาเวลาเปิดเว็บแล้วฟอนต์ประหลาดในบางเว็บ

1. เปิด Gedit ขึ้นมา แล้วคัดลอกข้อความข้างล่างไปวางไว้

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<!-- Disable sub-pixel rendering. X detects it anyway, and if you set this as well, it just looks really horrible --> <match target="font" >
<edit mode="assign" name="rgba" >
<const>rgb</const>
</edit>
</match>
<match target="font" >
<edit mode="assign" name="hinting" >
<bool>false</bool>
</edit>
</match>
<match target="font" >
<edit mode="assign" name="hintstyle" >
<const>hintnone</const>
</edit>
</match>
<!-- The first part of the 'magic.' This makes the fonts start to look nice, but some of the shapes will be distorted, so hinting is needed still --><!-- Autohinter is not turned on automatically. Only disable this if you have recompiled Freetype with the bytecode interpreter, which is run automatically. Although to be honest, Freetype are right, there isn't much difference between the two. Note that OpenOffice is built against the bytecode interpreter, so even if you have compiled it and override it with the autohinter, OOo will still use the bytecode interpreter --> <match target="pattern" >
<edit mode="assign" name="autohint" >
<bool>false</bool>
</edit>
</match>
<match target="font" >
<edit mode="assign" name="dpi" >
<double>96</double>
</edit>
</match>
<!-- Helvetica is a non true type font, and will look bad. This replaces it with whatever is the default sans-serif font --> <match target="pattern" name="family" >
<test name="family" qual="any" >
<string>Helvetica</string>
</test>
<edit mode="assign" name="family" >
<string>DejaVu Sans Thai</string>
</edit>
</match>
<dir>~/.fonts</dir>
<match target="font" >
<edit mode="assign" name="antialias" >
<bool>true</bool>
</edit>
</match>
</fontconfig>


เสร็จแล้วทำการบันทึกเป็นชื่อไฟล์ .fonts.conf หากมีไฟล์เก่าอยู่ก่อนให้สำรองไฟล์เก่าไว้ก่อน โดยการเปลี่ยนชื่อไฟล์ .fonts.conf เก่าเป็นชื่ออื่น

สร้างลิงค์ไฟล์ .fonts.conf ไปยังยูสเซอร์ root ด้วย

sudo ln -s .fonts.conf /root/

sudo fc-cache

รีบูตหนึ่งครั้ง กลับมาเปิดเว็บ ที่ฟอนต์มีปัญหา ก็จะสวยงามแล้วครับ

ไม่มีความคิดเห็น: