1

Does TTF_OpenFont have any sort of path or standard install location it looks in, or only in the current working directory?

If the latter – have any conventions been established as to where applications install the TrueType fonts they need? I'm on a Mac, but I'm interested in the answer for Mac and Windows both.

genpfault
  • 51,148
  • 11
  • 85
  • 139
Joymaker
  • 813
  • 1
  • 9
  • 23
  • Windows has a standard `c:/Windows/fonts folder`, but it can also contain subfolders. It uses the Registry to track where each font is stored; from within a Windows program, all you ever need is the font's *name*. – Jongware Jan 16 '18 at 11:18

1 Answers1

1

TTF_OpenFont doesn't use any standard location to search for a font. You can give it a relative, to where your executable is (relative to the directory it is in, for example you could use chdir) or a full path.

Imo is best for you to ship the fonts you'll be using with your application.

aram
  • 1,415
  • 13
  • 27
  • Which comes back to the same question: where, customarily, should the fonts go that I ship with my application? Especially for Windows. Can they somehow be bound into the .exe file? Or sitting alongside the .exe file in the same directory? Or installed in a customary central place for my application and other applications to use? Likewise for Mac – is it considered better form to bind the fonts I will use into the package, or to put them in some central place to the benefit of all? – Joymaker Jan 16 '18 at 05:16
  • @Joymaker Some frameworks like qt let you embed files inside your binary, I think you can also do this in windows, or roll your own serialization into an executable by hand, which although not difficult would be a bit annoying, I generally have (in case of games) a resources folder [resources/sprites resources/text] relative to the binary and then do a chdir(to resources) and act as if these folders were alongside the executable. Thus doing TTF_OpenFont("fonts/font_name"); I don't know if this is the best approach but is the one that fits me :). – aram Jan 16 '18 at 12:16