[OpenFontLibrary] [Blueprint font-face-generator] The library must automatically generate @font-face files for uploaded fonts

Schrijver eric at authoritism.net
Mon Mar 21 01:36:10 PDT 2011


Op 21 mrt 2011, om 09:05 heeft Dave Crossland het volgende geschreven:

> On 21 March 2011 02:13, Christopher Adams <chris at raysend.com> wrote:
>> 
>> The question I want to pose to this list is, what is the best solution
>> for OFLB to generate webfonts on the fly for all uploaded font files?
> 
> Given uploads require a TTF, then the only conversion neccessary is to
> generate an EOT with ttf2eot - since all platforms support TTF web
> fonts now, except MSIE before v9 (although, MSIE9 only supports TTF
> with an fsType of 0)
> 
> http://code.google.com/p/ttf2eot/


Hello,

Do uploads require a TTF?
Isn’t it possible to upload an OTF?

Also, iOS supports only SVG fonts.
I’ve been looking at FontSquirrels @font-face generator as the model for how I’d want to generate webfonts for the typefaces I work with…

I’d use fontforge (as I’m sure they do), combined with ttf2eot

#!/usr/bin/env python
# makewebfonts.py
# makes sure there’s at least a ttf, eot, svg and woff version of a font

import fontforge
import subprocess
import sys
from os.path import splitext

def make_webfonts(font_file):
    font = fontforge.open(font_file)
    input_name, input_extension = splitext(font_file)
    for extension in ['.svg','.ttf','.woff']:
        if extension != input_extension:
            font.generate("%s%s" % (input_name,extension))
    subprocess.call(['ttf2eot', "%s%s" % (input_name,'.ttf') , "%s%s" % (input_name,'.eot')])

if __name__ == "__main__":
    make_webfonts(sys.argv[1])




More information about the OpenFontLibrary mailing list