English 中文(简体)
How can I convert OTF/TTF files to EOT format?
原标题:

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?

最佳回答

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.

问题回答

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

In Ubuntu, install mkeot:

sudo apt-get install eot-utils

Then:

mkeot fontfilename.otf > fontfilename.eot

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.

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

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

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





相关问题
CSS working only in Firefox

I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....

jquery ui dialog opens only once

I have a button that opens a dialog when clicked. The dialog displays a div that was hidden After I close the dialog by clicking the X icon, the dialog can t be opened again.

Drop down background url in Safari Issue

selectBox.selectCSS { background: url(/Images/replacementSelectBackground.png) top left no-repeat height:auto; } I have an issue in Safari only where the image is not rendering on top ...

CSS specific for Safari

How do you target specifically safari in css with styles?

Aligning textarea in a form

Ive used the following css code to align my form elements: form { position:relative; } form input { position:absolute; left:11em; } However, the textarea element is not aligned correctly with the ...

Firefox background image horizontal centering oddity

I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...

CSS problem with page footer

I have defined my page footer in the css file as: #footer { position: absolute; height: 50px; text-align: center; background: #66CCCC; bottom: 0px; left: 0px; width: 100%; height: ...

热门标签