Skip to content

Instantly share code, notes, and snippets.

@sfelde
Forked from sergejmueller/ttf2woff2.md
Created May 29, 2014 21:39
Show Gist options
  • Save sfelde/fea1c6f247ede0411bf1 to your computer and use it in GitHub Desktop.
Save sfelde/fea1c6f247ede0411bf1 to your computer and use it in GitHub Desktop.

Revisions

  1. Sergej Müller revised this gist May 25, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion ttf2woff2.md
    Original file line number Diff line number Diff line change
    @@ -6,7 +6,7 @@ Google Chrome Developers [says](http://blog.chromium.org/2014/05/chrome-36-beta-

    ### TTF to WOFF2 converting

    I have installed [Googles compression library](https://code.google.com/p/font-compression-reference/) on a [DigitalOcean](https://www.digitalocean.com/?refcode=8e93f78ed2ab) _(ref)_ server. Feel free to start the convert from TTF to WOFF2. *No software installation required.* Simply use your terminal. Web developers, make your life easier!
    I have installed [Googles compression library](https://code.google.com/p/font-compression-reference/) on a [DigitalOcean](https://www.digitalocean.com/?refcode=8e93f78ed2ab) _(ref)_ server. Feel free to start the convert from TTF to WOFF2. *No software installation required.* Simply use your terminal window. Web developers, make your life easier and webpages faster!


    ###### Terminal make the magic
  2. Sergej Müller revised this gist May 25, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion ttf2woff2.md
    Original file line number Diff line number Diff line change
    @@ -6,7 +6,7 @@ Google Chrome Developers [says](http://blog.chromium.org/2014/05/chrome-36-beta-

    ### TTF to WOFF2 converting

    I have installed [Googles compression library](https://code.google.com/p/font-compression-reference/) on a [DigitalOcean](https://www.digitalocean.com/?refcode=8e93f78ed2ab) _(ref)_ server. Feel free to start the convert from TTF to WOFF2. No software installation required. Simply use your terminal.
    I have installed [Googles compression library](https://code.google.com/p/font-compression-reference/) on a [DigitalOcean](https://www.digitalocean.com/?refcode=8e93f78ed2ab) _(ref)_ server. Feel free to start the convert from TTF to WOFF2. *No software installation required.* Simply use your terminal. Web developers, make your life easier!


    ###### Terminal make the magic
  3. Sergej Müller revised this gist May 25, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion ttf2woff2.md
    Original file line number Diff line number Diff line change
    @@ -68,4 +68,4 @@ AddType font/woff2 .woff2


    ### Powered by
    Sergej Müller – [Flattr](https://flattr.com/submit/auto?user_id=sergej.mueller&url=https%3A%2F%2Fgist.github.com%2Fsergejmueller%2Fcf6b4f2133bcb3e2f64a) | [Twitter](https://twitter.com/wpseo) | [Google+](https://plus.google.com/110569673423509816572?rel=author) | [Projects](http://wpcoder.de)
    Sergej Müller – [Twitter](https://twitter.com/wpseo) | [Google+](https://plus.google.com/110569673423509816572?rel=author) | [Projects](http://wpcoder.de)
  4. Sergej Müller revised this gist May 25, 2014. No changes.
  5. Sergej Müller revised this gist May 25, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion ttf2woff2.md
    Original file line number Diff line number Diff line change
    @@ -68,4 +68,4 @@ AddType font/woff2 .woff2


    ### Powered by
    Sergej Müller – [Twitter](https://twitter.com/wpseo) | [Google+](https://plus.google.com/110569673423509816572?rel=author) | [Projects](http://wpcoder.de)
    Sergej Müller – [Flattr](https://flattr.com/submit/auto?user_id=sergej.mueller&url=https%3A%2F%2Fgist.github.com%2Fsergejmueller%2Fcf6b4f2133bcb3e2f64a) | [Twitter](https://twitter.com/wpseo) | [Google+](https://plus.google.com/110569673423509816572?rel=author) | [Projects](http://wpcoder.de)
  6. Sergej Müller revised this gist May 25, 2014. 1 changed file with 6 additions and 0 deletions.
    6 changes: 6 additions & 0 deletions ttf2woff2.md
    Original file line number Diff line number Diff line change
    @@ -53,7 +53,13 @@ AddType font/woff2 .woff2
    ```


    ### Browser Support

    * Google Chrome 36


    ### Helpful links

    * [W3C: WOFF File Format 2.0](http://www.w3.org/TR/WOFF2/)
    * [A better web font compression format: WOFF 2.0](https://groups.google.com/a/chromium.org/forum/#!topic/chromium-dev/j27Ou4RtvQI/discussion)
    * [Progress on smaller and more colorful fonts](http://lwn.net/Articles/573348/)
  7. Sergej Müller created this gist May 25, 2014.
    65 changes: 65 additions & 0 deletions ttf2woff2.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,65 @@
    ### Prolog

    Google Chrome Developers [says](http://blog.chromium.org/2014/05/chrome-36-beta-elementanimate-html.html):
    > The new WOFF 2.0 Web Font compression format offers a 30% average gain over WOFF 1.0 (up to 50%+ in some cases). WOFF 2.0 will be available from Chrome M36 (beta) and there on.

    ### TTF to WOFF2 converting

    I have installed [Googles compression library](https://code.google.com/p/font-compression-reference/) on a [DigitalOcean](https://www.digitalocean.com/?refcode=8e93f78ed2ab) _(ref)_ server. Feel free to start the convert from TTF to WOFF2. No software installation required. Simply use your terminal.


    ###### Terminal make the magic

    ```bash
    curl --data-binary "@/local/path/font.ttf" -o "/local/path/font.woff2" -H "Content-Type: font/ttf" -H "Accept: font/woff2" -X POST http://188.226.250.76
    ```

    _Required adjustments:_
    - `@/local/path/font.ttf` is the local path to your TTF file (including the leading _@_ character).
    - `/local/path/font.woff2` is the local path for the converted WOFF2 file.
    - Please don't change the header (_Content-Type_ and _Accept_).


    ### Embed WOFF2 in CSS

    ```css
    @font-face {
    font-family: MyFont;
    src:
    url('myfont.woff2') format('woff2'),
    url('myfont.woff') format('woff');
    }
    ```


    ### Good to know

    * No serverside GZIP compression for WOFF files, because WOFF already contains compressed data.
    * Think about the correct mime type value for WOFF 2.0 web fonts (Google uses _font/woff2_ as mime type):

    ###### NGINX: WOFF2 mime type

    ```nginx
    types {
    font/woff2 woff2;
    }
    ```

    ###### APACHE: WOFF2 mime type

    ```apache
    AddType font/woff2 .woff2
    ```


    ### Helpful links
    * [W3C: WOFF File Format 2.0](http://www.w3.org/TR/WOFF2/)
    * [A better web font compression format: WOFF 2.0](https://groups.google.com/a/chromium.org/forum/#!topic/chromium-dev/j27Ou4RtvQI/discussion)
    * [Progress on smaller and more colorful fonts](http://lwn.net/Articles/573348/)
    * [How to test WOFF 2.0](https://code.google.com/p/font-compression-reference/wiki/testing_woff2)
    * [WOFF 2.0 Compression on Google Fonts](https://docs.google.com/spreadsheet/ccc?key=0AvcH1ZzSrGMGdGl6MGRhdVRzYjN3T1NZSTBLM0ZUMnc#gid=0)


    ### Powered by
    Sergej Müller – [Twitter](https://twitter.com/wpseo) | [Google+](https://plus.google.com/110569673423509816572?rel=author) | [Projects](http://wpcoder.de)