fonts
fonts: บันทึกการทดลองทำ DejaVuSerifThai อีกรุ่น
Submitted by wd on Fri, 2008-05-02 14:36
Tags:
บันทึกการสร้างฟอนต์ DejaVu Serif Thai
- ตัวนี้ทดลองทำ hinting เลียนแบบวิธีของ Tahoma คือ
คงระยะคงที่ช่องไฟหน้าและหลังไว้ และให้ความกว้างของตัวอักษรเป็นตัวรองรับระยะการทดจุดที่เปลี่ยนไปมา ซึ่งบังคับว่าต้องทำ grid fitting (delta hint) เพื่อกำหนดความกว้างของฟอนต์ก่อน แล้วจึงเริ่มเดินจุด
การทำ delta hint ก่อน จำเป็นมากสำหรับฟอนต์ขนาดเล็ก ซึ่งมีอัตราการเพี้ยนของความกว้างของอักษรมาก ไหน ๆ ก็ต้องทำ delta hint อยู่แล้ว เที่ยวนี้จึงพยายามลงลึกไปทำถึงขนาดหัวอักษรด้วย ผลที่ได้คืออ่านง่ายขึ้น โดยเฉพาะกับฟอนต์ขนาดเล็ก ๆ แต่ก็ต้องแลกมาด้วยการเสียเวลาและสายตาเป็นอย่างมาก
fonts: ตัวอย่างการ hint ค.ควาย
ค่า cvt ที่เกี่ยวข้องคือ
cvt_dict = {
...
"w_1001": 71, #1001 =width of kho_kwai
"w_690": 14, #690 =
"front_kai": 11, #113 =front spacing of ko_kai
"hstem": 8, #184 =horizontal stem thick
"headstem": 258, #116 =head stem thick
"headstem_plus_hole": 259, #268 =head stem thick + head hole width
"vheight_shoot": 184, #1147 =overshoot height
"vstem_curve": 185, #156 =curve range vertical stem
...
}
...
"w_1001": 71, #1001 =width of kho_kwai
"w_690": 14, #690 =
"front_kai": 11, #113 =front spacing of ko_kai
"hstem": 8, #184 =horizontal stem thick
"headstem": 258, #116 =head stem thick
"headstem_plus_hole": 259, #268 =head stem thick + head hole width
"vheight_shoot": 184, #1147 =overshoot height
"vstem_curve": 185, #156 =curve range vertical stem
...
}
ภาพลายเส้น
fonts: ตัวอย่างการ hint ข.ไข่
ค่า cvt ที่เกี่ยวข้องคือ
cvt_dict = {
...
"w_690": 14, #690 =width of kho_khai
"hstem": 8, #184 =horizontal stem
"vstem": 96, #154 =vertical stem
"headstem": 258, #116 =head stem
"headstem_plus_hole": 259, #268 =head stem + hole width
"headdia": 257, #384 =head diameter
"vheight": 188, #1120 =normal height
"vheight_shoot": 184, #1147 =overshoot height
"front_khai": 32, #51 =front spacing of kho_khai
...
"w_690": 14, #690 =width of kho_khai
"hstem": 8, #184 =horizontal stem
"vstem": 96, #154 =vertical stem
"headstem": 258, #116 =head stem
"headstem_plus_hole": 259, #268 =head stem + hole width
"headdia": 257, #384 =head diameter
"vheight": 188, #1120 =normal height
"vheight_shoot": 184, #1147 =overshoot height
"front_khai": 32, #51 =front spacing of kho_khai
fonts: ตัวอย่างการ hint ก.ไก่
มีค่า cvt ของฟอนต์ DejaVu Sans ที่เกี่ยวข้อง ทำเป็นตัวแปรแบบดิกชันนารีในไพธอน คือ
cvt_dict = {
...
"front_kai": 11, #113 =front spacing of ko_kai
"hstem": 8, #184 =horizontal stem width
"w_881": 163, #881 =width of ko kai
"vheight_shoot": 184, #1147 =overshoot height
"vstem_curve": 185, #156 =curve vertical stem width
...
}
...
"front_kai": 11, #113 =front spacing of ko_kai
"hstem": 8, #184 =horizontal stem width
"w_881": 163, #881 =width of ko kai
"vheight_shoot": 184, #1147 =overshoot height
"vstem_curve": 185, #156 =curve vertical stem width
...
}
ค่า cvt ของฟอนต์ ดูได้จากเมนูของ FontForge คือ
Hints -> Edit 'cvt' ... โดยจะเรียงตั้งแต่ลำดับที่ 0 เป็นต้นไป
fonts: โค๊ดไพธอนที่ใช้ช่วยทำงาน
Submitted by wd on Mon, 2008-04-21 12:05
Tags:
สรุปรวมจาก python: เขียนโค๊ดคลี่แสต็กฟอนต์ และ python: โค๊ดฟอนต์ย้อนกลับ
รวมเป็นไฟล์เดียว ตั้งชื่อว่า dfont.py การทำงานแค่คลี่และเรียงแสต็กใหม่
เวลาใช้งาน จะต้องเขียนสคริปต์ไพธอนเพิ่มสำหรับฟอนต์แต่ละตัว เพื่อมาเรียกใช้ dfont เป็นมอดูล








Recent comments
1 week 2 days ago
1 week 3 days ago
2 weeks 3 days ago
7 weeks 6 days ago
7 weeks 6 days ago
9 weeks 5 days ago
9 weeks 5 days ago
12 weeks 6 days ago
15 weeks 3 days ago
15 weeks 4 days ago