Skip to content

Instantly share code, notes, and snippets.

@keighl
Last active December 9, 2021 14:00
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save keighl/5434540 to your computer and use it in GitHub Desktop.
Save keighl/5434540 to your computer and use it in GitHub Desktop.
Rename a font to have the same Family/Fullname/Postscript name. This prevents IE from choking in @font-face
# FontForge command
fontforge -script 2ttf.pe ProprietaryFontCondensedBold.otf
# 2ttf.pe
# FontForge Script
# http://fontforge.org/scripting.html
#
# * Opens the font file
# * Sets the family/fullname/postscript name be the same as the filename (without ext)
# * Writes it to the disk as TTF
Open($1)
SetFontNames($1:r,$1:r,$1:r)
Generate($1:r + ".ttf")
@schmidt9
Copy link

schmidt9 commented Dec 9, 2021

I had to fix this because $1:r is full path, if you are not in the font directory it contains slashes that are not allowed in font names

Open($1)
name=$1:t:r
SetFontNames(name,name,name)
Generate($1:r + ".ttf")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment