Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to decode base64-encoded font information?

Tags:

css

base64

fonts

I encountered a website which used encoded font information. I tried to convert this encoded font to a binary file through the Base64 Endoder/Decoder Web service, but I couldn't find out what is the format of the resulting file.

Here is the encoded CSS content (the content is too big to be copied/paste here).

Thanks!

[EDIT]

Please don't speculate on what I want to do.

I am asking questions about how the base64 code has been forged and what I am missing to be able to reverse the process, which means I do not understand everything in it. These technique is often used in webpages with custom fonts, and seems to have some improvements compared to the raw font file directly given reference in the CSS file. I am fully aware that the involved fonts are commercial ones and can't be used freely.

That debate is off-topic, stop trolling.

like image 493
Bernard Rosset Avatar asked Sep 07 '25 18:09

Bernard Rosset


1 Answers

1) locate the complete font declaration, for example, data:font/opentype;base64,AaBbCcDdEeFf0123456789==

2) copy the encoded data portion; exclude the leading type declaration and comma.

Drop this data:font/opentype;base64,

You want this: AaBbCcDdEeFf0123456789==

3) decode the data and save as a binary encoded file. Do not decode the data and manually paste the result into a text editor. Use http://www.motobit.com/util/base64-decoder-encoder.asp Select the "decode the data from a Base64 string" and "export to a binary file" options.

4) View the file using a plain text editor. The first 3 or 4 letters of the file are probably "woff", "otf", or "ttf". This is your actual file type.

like image 64
skibulk Avatar answered Sep 10 '25 02:09

skibulk