Reputation: 2694
As there are several issues related to fonts so it is best to convert it keep it in base 64 format. Sometimes sites like fontsquirrel.com etc. are not able to convert your fonts in base64 format showing issues like fonts are blacklisted or other issues. So how to convert fonts into base64 format in that case (in case we have no such legal issues with fonts)
Upvotes: 0
Views: 5042
Reputation: 2694
I just found a solution to encode fonts in base64 format using command prompt.
base64 name-of-thefont-file-name.woff
(I prefer to use .woff as it works with several advance browsers)
In case you are having difficulty in copying it from command prompt /terminal - you can redirect output to a file
base64 name-of-thefont-file-name.woff > base64encoded.txt
If one needs encoded font in just one line use following command
base64 -w 0 name-of-thefont-file-name.woff > base64encoded.txt
Now use this encoded code in css file using following code snippet -
@font-face { font-family: "Font Name"; src:url(data:font/woff;charset=utf-8;base64,font-file-in-encoded-form) format('woff'); font-weight: normal; font-style: normal; }
Upvotes: 3