• You are not authorized to view comments.
  • You are not authorized to view comments.

มาใช้ฟอนต์แปลก ๆ ในเว็บกันเถอะ

โดยปกติแล้ว ในเบราเซอร์ไม่สามารถใช้ฟอนต์แปลก ๆ ได้ แต่ตอนนี้เราสามารถใช้งานได้แล้ว โดยใช้ Cufón (สามารถอ่านเพิ่มเติมได้ที่ About Cufón) ซึ่งการใช้เว็บ cufón นั้นก็ไม่ยาก ดังนี้
1. เข้าไปที่เว็บไซต์ cufón - fonts for the people

2. อัพโหลดฟอนต์ที่ต้องการ จากนั้นเให้เลือกดังนี้

  • ในส่วนของ Select the font you'd like to use ให้เลือก The EULAs of these fonts allow Web Embedding (without Adobe Flash)
  • ในส่วนของ Include the following glyphs (if available) ให้เลือก All
  • ในส่วนของ Terms ให้เลือก I acknowledge and accept these terms

3. เมื่อเสร็จแล้วให้กดปุ่ม Let's do this! จากนั้นก็รอให้ทางเว็บไซต์ส่ง JavaScript กลับมาให้

การใช้ฟอนต์ในเว็บไซต์

1. ดาวน์โหลด cufon-yui.js

2. นำไฟล์ JavaScript ทั้ง 2 ไฟล์ (cufon-yui.js, example.font.js) เข้าไปในเว็บไซต์ ดังนี้

<script src="cufon-yui.js" type="text/javascript"></script>
<script src="example.font.js" type="text/javascript"></script>
<script type="text/javascript">
  Cufon.replace('.cufon');
</script>

3. นำข้อความที่ต้องการไปไว้ในส่วนที่ต้องการ เช่น

<div class="cufon" style="font-size: 32px;">
  ๏ ๏ กฤษณาสอนน้อง ๏ ๏<br/>
  ๏ พฤษภกาสร &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; อีกกุญชรอันปลดปลง<br/>
  โททนต์เสน่งคง &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; สำคัญหมายในกายมี<br/>
  ๏ นรชาติวางวาย &nbsp;&nbsp;&nbsp;&nbsp; มลายสิ้นทั้งอินทรีย์<br/>
  สถิตทั่วแต่ชั่วดี &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ประดับไว้ในโลกา<br/>
  ๏ ความดีก็ปรากฏ &nbsp;&nbsp;&nbsp; กิติยศฤาชา<br/>
  ความชั่วก็นินทา &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ทุรยศยินขจร<br/>
</div>

ผลที่ได้ คือ

ผลจากการใช้ cufon

สามารถดูตัวอย่างได้ที่ Demo Cufón