/CSSFont-Extractor

Extract bin64 encoded fonts into .woff format.

Primary LanguagePython

CSS Font Extractor

Extract fonts (.woff) encoded into base64 format from CSS files.

make_woff.sh - It gets one ore more CSS files as arguments, calls extract_font.py to extract the base64 strings as .txt files in ./output directory and converts them into .woff font files.

extract_font.py - Extracts base64 lines from CSS files and saves them into individual .txt files inside ./output directory. It tries to retrieve font name, weight and style from the CSS file and use this info for the file names generated in the format [NAME_WEIGHT_STYLE_]NUMBER.txt.

Optional

Use Woff2Otf tool by hanikesn to convert .woff files to .otf (the file is downloaded from GitHub on demand using curl, coverting to OTF is skipped if the file is not found).

Requirements

  • bash
  • curl
  • Python 3

All should be pre-installed by default, and it should run without problems on Linux and macOS, please report any issues.

How to run

Clone this git (or download then extract), then:

bash make_woff.sh FILE1.CSS [FILE2.CSS...]

Extra


TO-DOs are mentioned in the individual files. PR's and issues are welcome! 😊

Note: All this can be done easily using Chrome Dev Tools from Network Tab and saving base64 files into binary files as mentioned here. 😉😉