How do I convert my font to data
qassimhaider
Posts: 4
Comments
-
I'm not sure I understand your question. If you mean, 'How do I convert to WOFF format', a good answer is the program sfnt2woff available on GitHub. If you mean, how do I hide the fact that it's a font, you might be able to do something with the HTTP headers sent from the web server, but that makes no sense in the context of CSS.2
-
terminal:base64 font.ttf > fontbase64.txtthen embed it into your css with:
font-family: "Font";
src: url("data:font/<FONT FORMAT>;base64,<ENCODED TEXT FROM FILE>") format("<FONT FORMAT>");
}
3 -
Thanks for your help, yes perfectly it's through the terminal,base64 font.ttf > fontbase64.txt0
-
There really is no good reason to do this...$ base64 YourFont.ttf > Notsecure.txt
$ base64 -d Notsecure.txt > YourFontAgain.ttfWhat it does do is prevent the user's browser from caching that file (bad) and use ~25-50% more space more (also bad) and it forces the server to transmit that data, instead of more efficiently serving a file (also bad). Anybody who know how to grab a woff file from their browser console also knows how to save a base64 blob to a file.base64 is like zip, it does _nothing_ to protect your file. Unlike zip, it only makes your font larger in size.
5 -
What it does do is prevent the user's browser from caching that file (bad)use ~25-50% more space more (also bad)
It's 33%, or 36% if you have line breaks; and once the CSS file is gzipped the difference ends up being more like 1-2%.
There are good reasons to inline a font: when it is subsetted, and/or you are only using it one one page, and/or you are only using it in one shared stylesheet. I agree that it's not "protecting" the font in any way, not sure why you would want to try to do that anyway, it is a fool's errand.
A particularly good case for embedding fonts in data URIs is for icon fonts, if you wrote custom hinting code for your icons (making SVG not an option).2
Categories
- All Categories
- 43 Introductions
- 3.7K Typeface Design
- 798 Font Technology
- 1K Technique and Theory
- 617 Type Business
- 444 Type Design Critiques
- 541 Type Design Software
- 30 Punchcutting
- 136 Lettering and Calligraphy
- 83 Technique and Theory
- 53 Lettering Critiques
- 483 Typography
- 301 History of Typography
- 114 Education
- 68 Resources
- 498 Announcements
- 79 Events
- 105 Job Postings
- 148 Type Releases
- 165 Miscellaneous News
- 269 About TypeDrawers
- 53 TypeDrawers Announcements
- 116 Suggestions and Bug Reports