Provide or replace `FT_CALLBACK_DEF`
freetype as of v2.10.3 no longer exports
This breaks builds of VTK-8.2.0 when using the system's freetype:
/build/vtk/src/VTK-8.2.0/Rendering/FreeType/vtkFreeTypeTools.cxx:391:1: error: expected constructor, destructor, or type conversion before ‘vtkFreeTypeToolsFaceRequester’ 391 | vtkFreeTypeToolsFaceRequester(FTC_FaceID face_id, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /build/vtk/src/VTK-8.2.0/Rendering/FreeType/vtkFreeTypeTools.cxx: In member function ‘virtual FT_Error vtkFreeTypeTools::CreateFTCManager()’: /build/vtk/src/VTK-8.2.0/Rendering/FreeType/vtkFreeTypeTools.cxx:1252:26: error: ‘vtkFreeTypeToolsFaceRequester’ was not declared in this scope; did you mean ‘vtkFreeTypeToolsCleanupCounter’?
Source files using
The attached patch files (to be applied with
-p1) each work around this error.
Each patch file is sufficient; you may want to think about their pros and contras.
Provide the (unchanged) definition of
FT_CALLBACK_DEF, unless already defined, in
ThirdParty/freetype/vtk_freetype.h.in. This eliminates the need to change the usage.
Explicitly eliminate the reference to
FT_CALLBACK_DEFat the points of usage. This basically means using
extern "C"explicitly and seems to match the intent of the freetype developers more closely, but the freetype definition still notes the following caveat:
/* Some 16bit compilers have to redefine these macros to insert */ /* the infamous `_cdecl` or `__fastcall` declarations. */
If that flexibility is important to you, better stick with (1).
vtkFontConfigFreeTypeTools.cxxwraps an anonymous namespace around the
FT_CALLBACK_DEF. The second patch removes that anonymous namespace because its effect is undone by the