51

I need to use @font-face feature and my fonts are in OTF/TTF format and Microsoft browsers support only EOT format. I tried to use Microsoft tool WEFT, but it didn't work or I didn't understand how it works. Is there any other way to convert my fonts to EOT format?

newbie
  • 24,286
  • 80
  • 201
  • 301
  • 1
    You should contact the original foundry. They will provide you will the necessary files. In general you are not allowed to convert font files. Most EULA (license agreements) forbid that. – John Dec 04 '10 at 17:22

6 Answers6

66

Use the Font Squirrel Generator - this will produce not just EOT, but also SVG and WOFF formats, and converting multiple font files at once, and providing everything in a single archive along with the relevant CSS.

Peter Boughton
  • 110,170
  • 32
  • 120
  • 176
57

Here's a quick way to build ttf and eot versions from otf in one step. Of course you can pull out the relevant parts if you don't need all of it. Note that you to get eot from otf you have to go otf->ttf->eot.

Install both fontforge and ttf2eot. They are available in MacPorts, not sure about other platforms.

Save this as a script file named otf2ttf2eot.sh:

(This script has been updated for new fontforge versions; original script at end of post):

#!/bin/sh
otfFont="$1.otf"
ttfFont="$1.ttf"
eotFont="$1.eot"
fontforge -c '
import fontforge
font = fontforge.open("'$otfFont'")
font.generate("'$ttfFont'")
'
ttf2eot "$ttfFont" >"$eotFont"

Assuming you have a font named FontName.otf, run:

sh otf2ttf2eot.sh FontName

Original script for older versions of fontforge:

#!/bin/sh
# Convert an OTF font into TTF an EOT formats.
otfFont="$1.otf"
ttfFont="$1.ttf"
eotFont="$1.eot"
fontforge -c '
    Open("'$otfFont'");
    Generate("'$ttfFont'");
    Quit(0);'
ttf2eot $ttfFont > $eotFont
wberry
  • 18,519
  • 8
  • 53
  • 85
apinstein
  • 5,105
  • 1
  • 23
  • 22
  • 4
    I'm not sure this qualifies as "a quick way" or "in one step." It works, sure, but most people aren't going to have the patience to figure out how to compile and install fontforge and ttfeot on their system, then run a bunch of command line stuff. – matt lohkamp Feb 09 '11 at 23:46
  • 21
    @matt a perfectly viable solution gets a *downvote* because it's not perfectly convenient to you and contains "a bunch of command line stuff"? Seriously? +1 to even out. – Pekka Feb 09 '11 at 23:48
  • apinstein himself says "not sure about other platforms" - even fontforge's own site says "I no longer provide pre-built packages. You may either compile from source or download a package from another site (cygwin has a fontforge package)." ... so perfectly viable, yes, but convenient? not by any stretch of the imagination. – matt lohkamp Feb 10 '11 at 00:29
  • and as far as my criteria for voting it down goes: it's an answer that (although technically correct) I would be dismayed to receive if I had asked the question - the OP mentions already trying a utility with a gui that can be easily downloaded and installed on a windows box - which makes this answer much too complicated for what should be a simple operation. – matt lohkamp Feb 10 '11 at 00:41
  • 17
    If the question is on topic on a *programming* site, downloading and compiling are fair game. – bmargulies Feb 10 '11 at 02:28
  • @bmargulies - in general, yes, but look at the context - we're talking about web development. when was the last time you had to compile your .css? I'm not saying compiling something can never be a requirement in any answer, obviously, just that it's unnecessary for this particular case, and as such, this answer should be lower in the list than other more accessible solutions. – matt lohkamp Feb 10 '11 at 05:02
  • 3
    If I'd found an easier way to do this, I'd have done it the easy way. Truth is, I couldn't find an easier way (at least as of when I did it). However, if you need all three types for your application, this is a correct, straightforward way to get there. – apinstein Jul 15 '11 at 13:12
  • I actually like the idea behind this (I'd rather script than upload everything manually) but it doesn't work for me. Installed font-forge via apt-get install fontforge (latest ubuntu server) and tried to run ity. First it compained about the indentation so i removed that. Now I get "NameError: name 'Open' is not defined". Seems that fontforge scripting must now be done via python (which i've never used) but the examples on teh fontforge website are still of the style used here! Any chance someone could post a simple fixed version of the fontforge script? – Adam Oct 25 '12 at 11:35
  • 1
    Of course having struggled for over an hour i find the soilution uyself within minutes of posting. You must "export FONTFORGE_LANGUAGE=ff" before running the script – Adam Oct 25 '12 at 11:39
  • With the latest `fontforge` and `ttf2eot` installed via [homebrew](http://mxcl.github.io/homebrew/) I could not get this script to work. However I have place an updated version of the script (March 2013) here: https://gist.github.com/rc1/5346303 – Ross Apr 09 '13 at 14:49
  • @apinstein can you confirm your version no longer works? If so update I/you could update your answer? – Ross Apr 09 '13 at 14:51
  • I edited the answer to include an updated script for the Python-based scripting interface used in newer versions of fontforge. I tested it first. – wberry Sep 26 '13 at 23:05
  • It's **quicker** when you have to do about 20+ fonts. A+ – Orwellophile Feb 08 '14 at 06:53
8

In Ubuntu, install mkeot:

sudo apt-get install eot-utils

Then:

mkeot fontfilename.otf > fontfilename.eot
Federico
  • 3,650
  • 4
  • 32
  • 45
5

Use http://www.font2web.com/ - this will produce not just EOT, but also SVG and WOFF formats, and converting multiple font files at once, and providing everything in a single archive along with the relevant CSS.

Mark Martin
  • 153
  • 2
  • 5
  • 11
0

Also worth checking is everything fonts font-face converter. This has woff2 and EOT support as well.

https://everythingfonts.com/font-face

If you just want eot conversion they have that too.

https://everythingfonts.com/otf-to-eot

dors
  • 1,152
  • 11
  • 19
  • The site has a low file size limit before you have to pay – Savage Apr 22 '20 at 12:07
  • I am concerned that the resulting files are consistently larger than the same file converted using simple open-source methods. Is it embedding something sneaky? How could you tell? – user9645 Jul 01 '21 at 22:19
0

http://www.flaticon.com/font-face

For me, it returned all the font type in a zipped file

Guman Thakur
  • 27
  • 1
  • 4