Conversation
|
I assume you have just included all of freetype here? Thats a lot of files added, do we need all of them? can we just keep the ones were actually using? |
Surprisingly, no. If you look at the If you care so much about the number of files, you could always just include only the prebuilt binaries (in the
I haven’t personally built it on macOS, but the process should be similar. Most likely, porting |
- Update to the latest version (`2.13.3`) - Add a build script (`build_freetype.bat`) - Add support for OTF files - Only build and include necessary files
The build script now detects the platform (`x64` vs `x86`) of `cl` and builds into the appropriate folder. This only works when `cl` is set up via `setup_cl_xxx.bat`. If `cl` is added directly to `PATH`, the detection will likely fail because it relies on the `%Platform%` variable.
Overview
2.13.3)build_freetype.batDetails
FreeType is configured and built following this video. The old 4coder build only included the font driver for TTF fonts (
truetype.c). I’ve added an additional driver for OTF fonts (cff.c). After that, you need to include a renderer to rasterize the glyphs. For this, I use thesmooth.crenderer.src/truetype/truetype.cneedssfnt.candpsnames.csrc/cff/cff.cneedssfnt.c,psaux.c, andpsnames.c.INSTALL.ANYsayspshinter.cis required and doesn't mentionpsaux.c. This is incorrect. The latter is mandatory, while the former is only needed for hinting. I include both.src/cff/,src/psaux/,src/truetype/, etc.) are copied as-is, except that I removed allmkfiles. The only exception issrc/base/, where I deleted several unnecessary files.You need to put all these source folders inside
non-source/foreign/freetype2/src/. Next to thesrcdirectory, add thefreetypefolder copied fromfreetype-x.x.x/include/freetype. This folder contains all the header files required to use the library.The
ft2build.h,long_ftmodule.h, andlong_ftoption.hfiles are configured the same way as shown in the previous video. The main difference from the old 4coder setup is that I disable file stream support that relies on the CRT by definingFT_CONFIG_OPTION_DISABLE_STREAM_SUPPORT. As a result,FT_New_Facecannot be used—you must useFT_Open_Faceinstead. If you don’t want this behavior, simply comment out the#define.