Google Font API ã§æ軽ã«å§ãããã©ã³ãéã³
æ¨æ¥éå¬ããã WDE ex -vol9 (Twitter TL) ã®æ親ä¼ã§ãGoogle ããã©ã³ãã®ãã¹ãã£ã³ã°ããã°è¯ããããªãããã¨ãã話é¡ãåºã¦ããã®ã§ãããæèµ·ããã Google Font API ã¨ãã¦ç¾å®çãªãã®ã¨ãªã£ã¦ãã¾ãããWeb Font ããã¹ãã£ã³ã°ãã¦ãããµã¼ãã¹ã¯æµ·å¤ã§æ¢ã«å¹¾ã¤ãããã¾ãããã»ã¨ãã©ã JavaScript ã®ã³ã¼ããè²¼ä»ããæ¹æ³ãæ¡ç¨ããã¦ãããä¸ã«ã¯ body
å
ã«è¨è¿°ããªããã°ãªããªããã®ããããã¨ã¬ã¬ã³ããªæ¹æ³ã¨ã¯ããã¾ããã§ããã
ä»åå ¬éããã Google ã® API 㯠JavaScript ã使ãã®ã§ã¯ãªããCSS ããªã³ã¯ããã ãã使ããããã©ã³ãããã£ã¬ã¯ããªããé¸ã³ããªã³ã¯ãã CSS ãã¡ã¤ã«ã«å¤æ°ã¨ãã¦ãã©ã³ãåãè¨è¿°ããã ãã«ãªãã¾ããã·ã³ãã«ãã¤ç°¡åã§ãã
<link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=Tangerine">
CSS ã ã㧠Web Font ãå©ç¨ãããã¨ãåºæ¥ã¾ãããJavaScript ãå©ç¨ãã¦æ§ã ãªã³ã³ãã¼ã«ãåºæ¥ãããã«ãªã£ã¦ãã¾ããWebFont Loader ã¨ããã©ã¤ãã©ãªãå©ç¨ããã°ãã©ã®ã¿ã¤ãã³ã°ã§ãã¼ãã£ã³ã°ãã Web Font ãããã¹ãã«é©å¿ãããããã³ã³ããã¼ã«ããããç¶æ¿ãããã Web Font ã®é çªãæå®ãããåºæ¥ã¾ããã©ã®ã¿ã¤ãã³ã°ã§ Web Font ãé©å¿ãããããç¹ã«éè¦ã§ããã©ã¦ã¶ãã¨ã«é©å¿ã®ããã¦æ¹ãç°ãªãã¾ãã
ä¾ãã° ChromeãSafariãIE ã§ã¯ãWeb Font ããã¼ãã£ã³ã°ãããã¾ã§ã¯ãé©å¿ããããããã¹ãã¨ãªã¢ã空ç½ã«ãªã£ã¦ãã¾ãã¾ããFirefox ã®å ´å㯠Web Font ããã¼ãã£ã³ã°ãããã¾ã§ãã£ãã©ã«ãã®ãã©ã³ãã§ããã¹ãã表示ããã¾ãããããã Web Font ã®æ±ããæ¹ã®éããçµ±ä¸ãããå ´åã« WebFont Loader ã¯é常ã«ä¾¿å©ã§ãã
å®ã¯ãã®ããã¸ã§ã¯ãã以åç´¹ä»ãã TypeKit 㨠Google ãå ±åã§è¡ã£ã¦ãããWebFont Loader ã¯ãªã¼ãã³ã½ã¼ã¹ã¨ãã¦å ¬éããã¦ãã¾ããGoogle AJAX Libraries APIã¨çµã¿åãããã°ãããæ©ã JavaScript ã©ã¤ãã©ãªãèªã¿è¾¼ããã¨ãå¯è½ã«ãªãã¾ãã
ç¾å¨ãGoogle Font API ã§å ¬éããã¦ãããã©ã³ãã¯ãã¹ã¦ãªã¼ãã³ã½ã¼ã¹ã§ããä»å¾ãã©ã³ãã®æ°ã¯å¢ãã¦ããã¨æãã¾ãããã»ã¼ãã¹ã¦ããªã¼ãã³ã½ã¼ã¹ã®å¯è½æ§ãé«ãã§ããããç¹å¨ãã¦ãããªã¼ãã³ã½ã¼ã¹ã®ãã©ã³ãã Google ã«ããã²ã¨ã¤ã«ã¾ã¨ãããã¦ãã®ã¯å©ç¨è è¦ç¹ããè¨ãã°å¤§å¤ä¾¿å©ã§ãããGoogle ã®ãµã¼ãã¼ãæ©ãã®ãåç·é度ãéãã®ãå¤å¥ãã«ããã§ããã100k åå¾ãããã©ã³ãã®èªã¿è¾¼ã¿ã¯é常ã«ã¹ã ã¼ãºã§ããããããªãããããã¹ãã®ã¬ã³ããªã³ã°ã ãã§å¤ãã®å¸¯åã使ãã®ã¯ãã£ãããªãæ°ããã¾ãã100k ããããã«å°ããããããããã¹ãã¬ã³ããªã³ã°ã®ææ³ãã³ã³ãã¯ãã«åºæ¥ãªãã®ãã¤ãèãã¦ãã¾ãã¾ãã常ç¨æ¼¢åã ãã«ãã¦ãè¨å¤§ãªãã¡ã¤ã«ãµã¤ãºã«ãªã£ã¦ãã¾ãæ¥æ¬èªã§ãä»å¾ Web Font ãæ軽ã«å©ç¨åºæ¥ãããã«ãªãããã«ã解決ãã¦ããã課é¡ã§ãã
ãã ä»åã®ãã¥ã¼ã¹ã§ã²ã¨ã¤ããããã¨ã¯ãã¾ãä¸æ©è¯ãæ¹åã¸é²ãã ã¨ãããã¨ã§ãããã