Search code examples
iosxcodemacosfreetypefreetype2

No result for freetype example program in Xcode


Currently I'm trying to use freetype in Xcode. My problem is that I make this simple example "Build succeeded" but when I click the executable file, there's nothing. There's just a default exec black image in the center of window. I search for the folders one by one but there's no other output. Anyone knows what exact output one will get from this example and where it locates?


Solution

  • That example is a command-line program, not a GUI program. You shouldn't try to compile it for iOS, because iOS doesn't make the command line available in the public SDK.

    Instead, compile it for your Mac, in a Terminal window:

    xcrun clang -I/usr/local/Cellar/freetype/2.5.5/include/freetype2 \
        -L/usr/local/Cellar/freetype/2.5.5/lib -g -o example1 example1.c -lfreetype
    

    You need to adjust the paths after the -I and -L flag for your FreeType installation. I installed it using Homebrew.

    After you've compiled it, you can run it. It prints 480 lines to the terminal, and each line has 640 columns. So you'll want to decrease the size of your Terminal font (menu bar > View > Smaller, do it a few times) and make the Terminal window full screen. You can also filter the output through grep to get rid of the entirely blank lines and use less -S to scroll through the output in 2-D. Here's my test command:

    ./example1 /System/Library/Fonts/Helvetica.dfont hello | grep '[^ ]' | less -S
    

    Here's what the output looks like:

    screen shot of example output