Alon
Alon

Reputation: 7758

How to add metadata to WOFF file?

I need to add a metadata.xml to a WOFF file that I have created using font-squirrel in order to use it with @font-face.

I want to add a metadata.xml to WOFF file like this one (that explains all about it):

http://www.w3.org/TR/WOFF/#appendix-a

I was told I can do it with this sfnt2woff but it is NOT USER FRIENDLY and quite complicated. I was wondering if there are other ways to do it (font-squirrel? other font convertors?)

thanks, Alon

Upvotes: 3

Views: 3115

Answers (2)

naena
naena

Reputation: 1

I too have a WOFF font. I tried both the following commands:

  1. sfnt2woff -v 1.0 -m metadata.xml <fontfile>.ttf
  2. sfnt2woff samagana.ttf

The font is 1k larger than the first one. However, Firefox → Tools → Page Info → Fonts does not display the included meta data. Maybe it is a bug in the Font Information extension, or this program.

Upvotes: 0

Scriptor
Scriptor

Reputation: 1125

Im not sure why you would need to add the metadata to the font, it works perfectly well without the metadata.xml

The xml file only adds information for font designers or vendors to include licensing or other information.

Top of css file:

@font-face {
font-family: font_name";
src: url('fonts/font_name.eot');
src: url('fonts/font_name.woff') format('woff'),  url('fonts/font_name.ttf') format('truetype'),  url('fonts/font_name.svg') format('svg');
font-style: normal;
font-weight: normal;
}

And then for example:

body {
font-family: "droid sans", Verdana;
}

Edit1:

Create somewhere a folder called myfonts place in that folder your metadata.xml the font.ttf(source font) and the sfnt2woff.exe (located here: http://people.mozilla.org/~jkew/woff/sfnt2woff.exe)

Create a text file open it, place this inside it

sfnt2woff -v 1.0 -m metadata.xml droid_sans.ttf

save it to that folder and call it: do-it-now.bat

Go to the folder and click once you are done. A font.woff should appear with metadata.xml added to it.

Usage for sfnt2woff:

sfnt2woff [-v <maj>.<min>] [-m <metadata.xml>] [-p <private.dat>] <otffile>
package OpenType <otffile> as WOFF, creating <otffile>.woff
Options:
-v <maj>.<min>     set font version number (major and minor, both integers)
-m <metadata.xml>  include metadata from <metadata.xml> (not validated)
-p <private.dat>   include private data block

Upvotes: 4

Related Questions