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
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
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.
Captured from web.archive.org on 21 Sep 2019. view this capture