Question

I have a data URI file for a font, and I'd like to reverse engineer the font file (any format).

Is this possible?

Was it helpful?

Solution

The data-URI should include everything you need to know to decode it. For a font, most likely it is going to be in a CSS @font-face declaration something like:

@font-face {
    font-family: ‘FontFamily’;
    src: url(data:font/woff;charset=utf-8;base64,BASE64_ENCODED_DATA) format(‘woff’);
}

To get that into file, simply use a base64 decoder to decode the BASE64_ENCODED_DATA portion and dump the result to a file.

HOWEVER: I'd be very cautious doing this without knowing the origin of the font file and confirming that you have rights to serve (redistribute) it in this manner. Many webfont services provide licensed font data via the data-URI scheme, but similar to image data, their serving it doesn't automatically grant others the right to redistribute it. Very likely any font license information is described in the CSS resource containing the @font-face declaration; it would be a good idea to check that over carefully.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top