看到字體反爬自己做一遍
1.准備一個字體庫,http://www.zhaozi.cn/html/fonts/china/benmo/2019-02-01/25085.html,命名成:bmyy.ttf
2.提取字符用到fonttools
fonttools安裝:
pip install fonttools
使用方法:
pyftsubset <字體文件> --text=<需要的字形> --output-file=<輸出>
參考:https://github.com/fonttools/fonttools
提取數字1234567890作為加密字符:
pyftsubset D:\font\bmyy.ttf --text=“1234567890”
命令在命令行執行,生成提取出來的字體bmyy.subset.ttf
修改
下一步網站只能上傳svg,需要把ttf轉成svg,鏈接:https://cloudconvert.com/ttf-to-svg
在http://fontello.com/修改字體,svg拖入網頁
選擇0~9字符
在customize codes重新編碼
上面是預覽,下面是unicode,隨便改改,完成后下載新字體
fontello參考:https://github.com/fontello/fontello/wiki/How-to-create-my-own-font
測試
導入新字體
<style>
@font-face { font-family:'new_font';
src: url('D:/font/new_font.woff') ,url('D:/font/new_font.eot'); /* IE9 */ }
.new_font
{
font-family:myFirstFont;
}
</style>
<html> <head> <title>new font</title> <meta charset="utf-8" lang="zh"> <style> @font-face { font-family: 'new_font'; src: url('D:/font/new_font.woff') } .new_font { font-family: "new_font"; } </style> </head> <body> <div> <span class="new_font">啦啦啦</span> </div> </body> </html>
瀏覽器上顯示
源碼里顯示