Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Oneechan69

macrumors 6502
Original poster
Mar 29, 2022
265
32
US
I just did a bunch of googling search and didn't find any good ones. What I'd like to do is take a folder with a bunch of .otf files and convert them to .ttf files. Ideally I'd run a command like this: fontconverter *.otf *.ttf, something elegant like that. Do you have any recommendations?
 
I just installed it with brew install fontforge. When I tried the command fontforge -lang=ff -c 'Open($1); Generate($2);' *.otf *.ttf, it only converted 1 file. Would you know how I could make it convert all otf files in a directory without shell scripting? If there isn't a way, then I'd suck it up and do that.
 
1. No need for homebrew, download the latest dmg from https://fontforge.org/en-US/downloads/mac-dl/
at the moment FontForge-2023-01-01-a1dad3e.app.dmg https://github.com/fontforge/fontforge/releases

2. Open the folder with fonts in Terminal
Example: fonts in /Users/bogdan/Downloads/OTF
Code:
cd ~/Downloads/OTF
Convert all otf fonts in the folder to ttf
Code:
for font in *.otf; do /Applications/FontForge.app/Contents/Resources/opt/local/bin/fontforge -lang=ff -c 'Open($1); Generate($2); Close();' $font "${font%.*}.ttf"; done
 
  • Like
Reactions: Oneechan69
1. No need for homebrew, download the latest dmg from https://fontforge.org/en-US/downloads/mac-dl/
at the moment FontForge-2023-01-01-a1dad3e.app.dmg https://github.com/fontforge/fontforge/releases

2. Open the folder with fonts in Terminal
Example: fonts in /Users/bogdan/Downloads/OTF
Code:
cd ~/Downloads/OTF
Convert all otf fonts in the folder to ttf
Code:
for font in *.otf; do /Applications/FontForge.app/Contents/Resources/opt/local/bin/fontforge -lang=ff -c 'Open($1); Generate($2); Close();' $font "${font%.*}.ttf"; done
Well there ya go, a shell script to iterate over each otf file and convert them. It would be nice if I could just type in a command to convert them all with wildcards and not need a shell, but fine.

Wdym no need for Homebrew?! Sometimes Homebrew is just much more convenient!

I'd rather just google if "Homebrew fontforge" and see that its available: https://formulae.brew.sh/formula/fontforge, type in brew install fontforge and its ready. Why googhle the website, look for the download button if its not obvious and or not on the front page, go to the downloads folder, open the DMG (or whatever file) and drag the .app file? That's like 30-60 more secs when the other method is just a few secs. And I'm already install a lot of CLIs with Homebrew and other package managers like pip.
 
1. No need for homebrew, download the latest dmg from https://fontforge.org/en-US/downloads/mac-dl/
at the moment FontForge-2023-01-01-a1dad3e.app.dmg https://github.com/fontforge/fontforge/releases

2. Open the folder with fonts in Terminal
Example: fonts in /Users/bogdan/Downloads/OTF
Code:
cd ~/Downloads/OTF
Convert all otf fonts in the folder to ttf
Code:
for font in *.otf; do /Applications/FontForge.app/Contents/Resources/opt/local/bin/fontforge -lang=ff -c 'Open($1); Generate($2); Close();' $font "${font%.*}.ttf"; done
I was going to wait for more answers here and on Reddit, but I just went ahead and ran your for loop, which works. Thanks!

I'll still take answers to see if there are better CLIs, a CLI where I could type in wildcards and or commands to quickly convert all fonts in a folder, like what I described earlier: fontconverter *.otf *.ttf.
 
Have you tried otf2ttf suggested by @Slartibart above #2 ?
Install:
Code:
pip3 install otf2ttf
Use:
Code:
~/Library/Python/3.9/bin/otf2ttf ~/Downloads/OTF/*.otf
 
I am curious: why the conversion? I mean, when we talk about glyph quality, if the original OTF has TT outlines, no quality is lost. Otherwise (PS outline to TT ), some quality will be lost in the conversion, but more importantly IMHO: when converting OTF to Tt the advanced typographic features on the original OTF will be lost (like the support for ligatures, old-style numerals, small caps, etc. ). OTF is in principle the much more capable format.
 
  • Like
Reactions: chrfr
I am curious: why the conversion? I mean, when we talk about glyph quality, if the original OTF has TT outlines, no quality is lost. Otherwise (PS outline to TT ), some quality will be lost in the conversion, but more importantly IMHO: when converting OTF to Tt the advanced typographic features on the original OTF will be lost (like the support for ligatures, old-style numerals, small caps, etc. ). OTF is in principle the much more capable format.
I've had a feeling that the conversion from OTF to TTF may or may not involve loss in quality or data. I don't know much about font formats, and would've thought that they're very complex, typography seems like a very complicated field, even as / for a porgrammer like myself that works hard to get a comprehensive understanding of the complicated world of Computer Science / programming / computers, but I digress.

I've been Obsidian on my Mac and iOS devices for a while, having spent lots of time writing custom CSS for them. Not only do I use the SF Pro font for my notes and UI, but I also extensively use SF Symbols to replace the Lucide icons, not every single one, only the ones I see in my setup. This necessitates having to use the SF Pro font, which isn't on Android for obvious reasons. I really don't like looking at the Roboto font on Obsidian for Android, SF Pro looks much better and that's what I'm used to looking at on my notes.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.