Mr. Fontastic
Mr. Fontastic

Reputation: 302

Decode base64-encoded string to font file - unicode range

I noticed recently that the method explained by Andrew Moore here isn't working anymore:

How to decode base64-encoded font information?

What I want to do is decode the base64-encoded string to a .bin file, then convert that .bin to .otf/.ttf.

I was able to do that successfully by follwoing Mr. Moore's example, but something changed in the encription (maybe) and I would like some help.

@font-face {
  font-family: "Family";
  font-style: normal;
  font-weight: normal;
  src: url("data:font/opentype;base64,T1RUTwAN....AHMAdgB0");
  unicode-range: U+0-10FFFF;
}

I believe the addition of "unicode-range" in the CSS may have something to do with it. Can someone please help me decode these files again? Thanks.

Upvotes: 1

Views: 1350

Answers (1)

Beau Smith
Beau Smith

Reputation: 34367

I answered this question on https://stackoverflow.com/a/37223719/101290

Here is the details:

Convert base64 fonts to other formats using the following steps:

  1. Copy the base64 data.

    In CSS it's the part marked "THIS_CODE":

    @font-face {
      font-family:"font-name-here";
      src:url(data:font/opentype;base64,THIS_CODE);
    }
    
  2. Decode the base64 data using a converter. Here are two online converters: opinionatedgeek.com and motobit.com

    These will both output a .bin file.

  3. Go to onlinefontconverter.com check the types of fonts that you want (maybe OTF or TTF) and then click "Select Font(s)" and upload the .bin file. Click "Done" and the site will find the desired font file formats, then offer you a link to download a zip file containing your desired font files.

Upvotes: 1

Related Questions