| ลิงก์ถาวร |
|---|
/index.html |
เว็บไซต์ (หน้า Git)
พวกเราหลายคนใช้ Google Fonts ผ่าน CDN อย่างไรก็ตามเยอรมนีได้ตัดสินใจว่าสิ่งนี้ขัดต่อ GDPR โดยปล่อยให้เจ้าของเว็บไซต์เปิดรับการดำเนินคดี
เรายังสามารถแสดง Google Fonts ได้โดย:
หมายเหตุ : หน้านี้มุ่งเน้นไปที่ Google Fonts แต่หลักการเดียวกันนี้ใช้กับตัวอักษรเว็บประเภทอื่น ๆ
Font Squirrel นี้ใช้ได้กับ "Roboto" แต่ล้มเหลวด้วยแบบอักษรคงที่ของทั้ง "Lato" และ "Open Sans"
Creative Fabrica ฉันใช้สิ่งนี้สำหรับไฟล์ "Lato" และ "Open Sans" ฉันต้องอัปโหลดแต่ละตัวแปรทีละครั้ง
ฉันได้รับคำแนะนำให้โหลดแบบอักษรไว้ล่วงหน้าในหน้า HTML นี่ควรจะเร่งการส่งมอบแบบอักษรและเพิ่มประสิทธิภาพการทำงานของเว็บหลัก (CWVs) ของ Google อย่างไรก็ตามฉันเห็นคำเตือนหลังจากทำสิ่งนี้ (ดูการทดสอบ/Firefox และ Firefox Developer Edition ด้านล่าง)
< head >
< link
rel =" preload "
href =" roboto-light-webfont.woff2 "
as =" font "
type =" font/woff2 "
crossorigin =" anonymous "
/>
< link
rel =" preload "
href =" roboto-regular-webfont.woff2 "
as =" font "
type =" font/woff2 "
crossorigin =" anonymous "
/>
< link
rel =" preload "
href =" roboto-medium-webfont.woff2 "
as =" font "
type =" font/woff2 "
crossorigin =" anonymous "
/>
...
<!-- CSS file comes after preload -->
</ head > @font-face {
font-family : "Roboto" ;
font-weight : 300 ;
src : url ( "roboto-light-webfont.woff2" ) format ( "woff2" ) , url ( "roboto-light-webfont.woff" )
format ( "woff" );
}
/** Regular: 400 **/
@font-face {
font-family : "Roboto" ;
font-weight : 400 ;
src : url ( "roboto-regular-webfont.woff2" ) format ( "woff2" ) , url ( "roboto-regular-webfont.woff" )
format ( "woff" );
}
/** Medium: 500 **/
@font-face {
font-family : "Roboto" ;
font-weight : 500 ;
src : url ( "roboto-medium-webfont.woff2" ) format ( "woff2" ) , url ( "roboto-medium-webfont.woff" )
format ( "woff" );
}ข้อมูลจำนวนมากมาจากแบบอักษรตัวอักษรที่อธิบาย (รวมถึง Google Fonts) // @Font-Face Tutorial (YouTube) ข้อมูลเกี่ยวกับการโหลดล่วงหน้า/CWVs และการปฏิบัติตามกฎระเบียบที่ไม่ใช่ GDPR เกิดขึ้นจากเธรดความคิดเห็นในหน้าเดียวกัน