Change embedding setting

Primary tabs

11 posts / 0 new
Last post
P. Zucker's picture
Offline
Joined: 23 Feb 2008 - 7:12am
Change embedding setting
0

How can I change the embedding setting of a TTF or OTF without opening each font with FL?
I recall there was a tool few years ago that could change the setting in a batch of files.

TIA

Hrant H Papazian's picture
Joined: 3 May 2000 - 11:00am
0

Why would you want to do that?

hhp

HVB's picture
HVB
Offline
Joined: 17 Feb 2006 - 9:43am
0

hrant: At one time there was a bug in Fontographer that defaulted ALL fonts to 'no embedding'. If the font creator even knew about it, finding the fsType entry to set the bits properly wasn't clear either. That's why there are thousands of older fonts that routinely need this fix.
- Herb

P. Zucker's picture
Offline
Joined: 23 Feb 2008 - 7:12am
0

Old fonts with Only printing ot editing restriction - need to change.

Hrant H Papazian's picture
Joined: 3 May 2000 - 11:00am
0

I would ask the font publishers if that would be ethical and legal.

hhp

P. Zucker's picture
Offline
Joined: 23 Feb 2008 - 7:12am
0

We are the publisher so this isn't an issue at all :-)

Hrant H Papazian's picture
Joined: 3 May 2000 - 11:00am
0

Oh, you just want to save time over using FL - I get it. Must be a lot of fonts!

hhp

Michel Boyer's picture
Offline
Joined: 2 Jun 2007 - 1:01pm
0

Is it ok to give a script online? It is just a few lines of python with AFDKOPython installed (last version of AFDKO).

Michel Boyer's picture
Offline
Joined: 2 Jun 2007 - 1:01pm
0

On the mac, to change to 0x0008 the value of fsType of all otf and ttf files in the current directory and subdirectories, all you need to do is to type in the terminal window

find . -iname "*.[to]tf" -exec chngfs {} 0x0008 \;

provided the call chngfs fontfile 0x0008 changes the fsType of fontfile to 0x0008. The following code for chngfs does it if AFDKO 2.5 for Mac is installed:

#!/usr/bin/env AFDKOPython

import sys, os
from fontTools.ttLib import TTFont

f=TTFont(sys.argv[1])
f["OS/2"].fsType=int(sys.argv[2],16)
if len(sys.argv) == 4:
f.save(sys.argv[3])
else:
f.save("tmpfil")
os.rename("tmpfil",sys.argv[1])

provided chngfs is made executable and put in your path.

As for Windows, the Python 2.7 documentation says it is not possible to rename with os.rename a file to a file name that is already in use. That is why chngfs above was written to take an additional, optional, argument. If AFDKOPython is made available at the command line on Windows then the command

AFDKOPython chngfs fontname.ttf 0x0008 newname.ttf

produces a new font with the chosen fsType (works the same on the mac).

You can also call chngfs with 0x0002 and 0x0004, 0x0008 as well as 0x0000 and variations 0x01?? and 0x02??; cf http://www.microsoft.com/typography/otspec/os2.htm#fst.

Michel

HVB's picture
HVB
Offline
Joined: 17 Feb 2006 - 9:43am
0

There is a small PC command line program named 'embed' that does what you're looking for, very simply. Unfortunately it's not compatible with more recent versions of Windows such as Windows 7. I'm not sure whether the Windows 7 Professional's compatibility mode would solve the problem.

Michel Boyer's picture
Offline
Joined: 2 Jun 2007 - 1:01pm
0

If there is no tool to give you simply the fsType of your files, here is a script that does it

#!/bin/sh
AFDKOPython <<EOF
from fontTools.ttLib import TTFont

f=TTFont("$1")
try:
print "%s; 0x%04x" % ("$1", f["OS/2"].fsType)
except:
print "%s; fsType not found" % ("$1")
EOF

If you call it fstype, make it executable and put it in a directory that is in your path on the Mac then

find . -iname "*.[ot]tf" -exec fstype {} \;

will list all ttf and otf files if the current directory and subdirectories with their fsType. I guess that should also work with Cygwin on Windows but I have no way to check.