Skip to content

Commit

Permalink
Make macros for header file names optional.
Browse files Browse the repository at this point in the history
We no longer have to take care of the 8.3 file name limit; this
allows us (a) to introduce longer, meaningful file names, and (b) to
avoid macro names in `#include' lines altogether since some
compilers (most notably Visual C++) doesn't support this properly.

*/*: Replace

   #include FOO_H

with

   #include <freetype/foo.h>

or something similar.  Also update the documentation.
  • Loading branch information
David Turner authored and lemzwerg committed Jun 8, 2020
1 parent 9e6e903 commit e133913
Show file tree
Hide file tree
Showing 330 changed files with 1,003 additions and 1,083 deletions.
19 changes: 19 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
2020-06-08 David Turner <[email protected]>

Make macros for header file names optional.

We no longer have to take care of the 8.3 file name limit; this
allows us (a) to introduce longer, meaningful file names, and (b) to
avoid macro names in `#include' lines altogether since some
compilers (most notably Visual C++) doesn't support this properly.

*/*: Replace

#include FOO_H

with

#include <freetype/foo.h>

or something similar. Also update the documentation.

2020-06-02 Werner Lemberg <[email protected]>

* src/sfnt/ttcmap.c (tt_face_build_cmaps): Trace number of cmaps.
Expand Down
6 changes: 3 additions & 3 deletions builds/amiga/src/base/ftdebug.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@


#include <ft2build.h>
#include FT_FREETYPE_H
#include FT_INTERNAL_DEBUG_H
#include <freetype/freetype.h>
#include <freetype/internal/ftdebug.h>


#ifdef FT_DEBUG_LEVEL_ERROR
Expand Down Expand Up @@ -152,7 +152,7 @@

static const char* ft_trace_toggles[trace_count + 1] =
{
#include FT_INTERNAL_TRACE_H
#include <freetype/internal/fttrace.h>
NULL
};

Expand Down
8 changes: 4 additions & 4 deletions builds/amiga/src/base/ftsystem.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,10 @@ Free_VecPooled( APTR poolHeader,

#include <ft2build.h>
#include FT_CONFIG_CONFIG_H
#include FT_INTERNAL_DEBUG_H
#include FT_SYSTEM_H
#include FT_ERRORS_H
#include FT_TYPES_H
#include <freetype/internal/ftdebug.h>
#include <freetype/ftsystem.h>
#include <freetype/fterrors.h>
#include <freetype/fttypes.h>

#include <stdio.h>
#include <stdlib.h>
Expand Down
2 changes: 1 addition & 1 deletion builds/cmake/testbuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ cat >$tmpdir/main.c << END
#include <stdlib.h>
#include <ft2build.h>
#include FT_FREETYPE_H
#include <freetype/freetype.h>
FT_Library library;
Expand Down
6 changes: 3 additions & 3 deletions builds/mac/ftmac.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@


#include <ft2build.h>
#include FT_FREETYPE_H
#include FT_TRUETYPE_TAGS_H
#include FT_INTERNAL_STREAM_H
#include <freetype/freetype.h>
#include <freetype/tttags.h>
#include <freetype/internal/ftstream.h>
#include "ftbase.h"

#if defined( __GNUC__ ) || defined( __IBMC__ )
Expand Down
4 changes: 2 additions & 2 deletions builds/unix/freetype2.m4
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# generated by Autoconf, under the same distribution terms as the rest of
# that program.
#
# serial 4
# serial 5

# AC_CHECK_FT2([MINIMUM-VERSION [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
# Test for FreeType 2, and define FT2_CFLAGS and FT2_LIBS.
Expand Down Expand Up @@ -116,7 +116,7 @@ AC_DEFUN([AC_CHECK_FT2],
AC_LANG_SOURCE([[
#include <ft2build.h>
#include FT_FREETYPE_H
#include <freetype/freetype.h>
#include <stdio.h>
#include <stdlib.h>
Expand Down
10 changes: 5 additions & 5 deletions builds/unix/ftsystem.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
#include <ft2build.h>
/* we use our special ftconfig.h file, not the standard one */
#include <ftconfig.h>
#include FT_INTERNAL_DEBUG_H
#include FT_SYSTEM_H
#include FT_ERRORS_H
#include FT_TYPES_H
#include FT_INTERNAL_STREAM_H
#include <freetype/internal/ftdebug.h>
#include <freetype/ftsystem.h>
#include <freetype/fterrors.h>
#include <freetype/fttypes.h>
#include <freetype/internal/ftstream.h>

/* memory-mapping includes and definitions */
#ifdef HAVE_UNISTD_H
Expand Down
10 changes: 5 additions & 5 deletions builds/vms/ftsystem.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
#include <ft2build.h>
/* we use our special ftconfig.h file, not the standard one */
#include <ftconfig.h>
#include FT_INTERNAL_DEBUG_H
#include FT_SYSTEM_H
#include FT_ERRORS_H
#include FT_TYPES_H
#include FT_INTERNAL_OBJECTS_H
#include <freetype/internal/ftdebug.h>
#include <freetype/ftsystem.h>
#include <freetype/fterrors.h>
#include <freetype/fttypes.h>
#include <freetype/internal/ftobjs.h>

/* memory-mapping includes and definitions */
#ifdef HAVE_UNISTD_H
Expand Down
6 changes: 3 additions & 3 deletions builds/wince/ftdebug.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@


#include <ft2build.h>
#include FT_FREETYPE_H
#include FT_INTERNAL_DEBUG_H
#include <freetype/freetype.h>
#include <freetype/internal/ftdebug.h>


#ifdef FT_DEBUG_LEVEL_ERROR
Expand Down Expand Up @@ -154,7 +154,7 @@

static const char* ft_trace_toggles[trace_count + 1] =
{
#include FT_INTERNAL_TRACE_H
#include <freetype/internal/fttrace.h>
NULL
};

Expand Down
6 changes: 3 additions & 3 deletions builds/windows/ftdebug.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@


#include <ft2build.h>
#include FT_FREETYPE_H
#include FT_INTERNAL_DEBUG_H
#include <freetype/freetype.h>
#include <freetype/internal/ftdebug.h>


#ifdef FT_DEBUG_LEVEL_ERROR
Expand Down Expand Up @@ -138,7 +138,7 @@

static const char* ft_trace_toggles[trace_count + 1] =
{
#include FT_INTERNAL_TRACE_H
#include <freetype/internal/fttrace.h>
NULL
};

Expand Down
10 changes: 6 additions & 4 deletions docs/INSTALL.ANY
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@ specific environments.
I. Standard procedure
---------------------

* DISABLE PRE-COMPILED HEADERS! This is very important for Visual
C++, because FreeType uses lines like:
* If you use macro names for FreeType header files (while mandatory
in earlier versions, this is now optional since FreeType version
2.11) it is necessary to disable pre-compiled headers. This is
very important for Visual C++, because lines like

#include FT_FREETYPE_H

which are not correctly supported by this compiler while being ISO
C compliant!
are not correctly supported by this compiler while being ISO C
compliant!

* You need to add the directory `include' to your include path when
compiling the library.
Expand Down
4 changes: 2 additions & 2 deletions docs/VERSIONS.TXT
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ The libtool-specific number does not equal the release number but is
tied to it.

The release number is available at *compile* time through the
following macros defined in FT_FREETYPE_H:
following macros defined in `freetype.h':

- FREETYPE_MAJOR: major release number
- FREETYPE_MINOR: minor release number
Expand Down Expand Up @@ -99,7 +99,7 @@ other release numbers.
AC_TRY_CPP([

#include <ft2build.h>
#include FT_FREETYPE_H
#include <freetype/freetype.h>

#if FREETYPE_MAJOR*10000 + FREETYPE_MINOR*100 + FREETYPE_PATCH < 21002
# error FreeType version too low.
Expand Down
42 changes: 24 additions & 18 deletions include/freetype/config/ftheader.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,23 +73,26 @@
* Macro definitions used to `#include` specific header files.
*
* @description:
* The following macros are defined to the name of specific FreeType~2
* header files. They can be used directly in `#include` statements as
* in:
* In addition to the normal scheme of including header files like
*
* ```
* #include <freetype/freetype.h>
* #include <freetype/ftmm.h>
* #include <freetype/ftglyph.h>
* ```
*
* it is possible to used named macros instead. They can be used
* directly in `#include` statements as in
*
* ```
* #include FT_FREETYPE_H
* #include FT_MULTIPLE_MASTERS_H
* #include FT_GLYPH_H
* ```
*
* There are several reasons why we are now using macros to name public
* header files. The first one is that such macros are not limited to
* the infamous 8.3~naming rule required by DOS (and
* `FT_MULTIPLE_MASTERS_H` is a lot more meaningful than `ftmm.h`).
*
* The second reason is that it allows for more flexibility in the way
* FreeType~2 is installed on a given system.
* These macros were introduced to overcome the infamous 8.3~naming rule
* required by DOS (and `FT_MULTIPLE_MASTERS_H` is a lot more meaningful
* than `ftmm.h`).
*
*/

Expand Down Expand Up @@ -797,16 +800,19 @@
#define FT_CACHE_INTERNAL_IMAGE_H FT_CACHE_H
#define FT_CACHE_INTERNAL_SBITS_H FT_CACHE_H


/*
* Include internal headers definitions from `<internal/...>` only when
* building the library.
*/
/* TODO(david): Move this section below to a different header */
#ifdef FT2_BUILD_LIBRARY
#define FT_INTERNAL_INTERNAL_H <freetype/internal/internal.h>
#include FT_INTERNAL_INTERNAL_H
#endif /* FT2_BUILD_LIBRARY */
#if defined( _MSC_VER ) /* Visual C++ (and Intel C++) */

/* We disable the warning `conditional expression is constant' here */
/* in order to compile cleanly with the maximum level of warnings. */
/* In particular, the warning complains about stuff like `while(0)' */
/* which is very useful in macro definitions. There is no benefit */
/* in having it enabled. */
#pragma warning( disable : 4127 )

#endif /* _MSC_VER */
#endif /* FT2_BUILD_LIBRARY */

#endif /* FTHEADER_H_ */

Expand Down
23 changes: 6 additions & 17 deletions include/freetype/freetype.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,13 @@

#ifndef FT_FREETYPE_H
#error "`ft2build.h' hasn't been included yet!"
#error "Please always use macros to include FreeType header files."
#error "Example:"
#error " #include <ft2build.h>"
#error " #include FT_FREETYPE_H"
#endif


#include <ft2build.h>
#include FT_CONFIG_CONFIG_H
#include FT_TYPES_H
#include FT_ERRORS_H
#include <freetype/fttypes.h>
#include <freetype/fterrors.h>


FT_BEGIN_HEADER
Expand All @@ -51,22 +47,15 @@ FT_BEGIN_HEADER
* How client applications should include FreeType header files.
*
* @description:
* To be as flexible as possible (and for historical reasons), FreeType
* uses a very special inclusion scheme to load header files, for example
* To be as flexible as possible (and for historical reasons), you must
* load file `ft2build.h` first before other header files, for example
*
* ```
* #include <ft2build.h>
*
* #include FT_FREETYPE_H
* #include FT_OUTLINE_H
* #include <freetype/freetype.h>
* #include <freetype/ftoutln.h>
* ```
*
* A compiler and its preprocessor only needs an include path to find the
* file `ft2build.h`; the exact locations and names of the other FreeType
* header files are hidden by @header_file_macros, loaded by
* `ft2build.h`. The API documentation always gives the header macro
* name needed for a particular function.
*
*/


Expand Down
2 changes: 1 addition & 1 deletion include/freetype/ftadvanc.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@


#include <ft2build.h>
#include FT_FREETYPE_H
#include <freetype/freetype.h>

#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
Expand Down
2 changes: 1 addition & 1 deletion include/freetype/ftbbox.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@


#include <ft2build.h>
#include FT_FREETYPE_H
#include <freetype/freetype.h>

#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
Expand Down
2 changes: 1 addition & 1 deletion include/freetype/ftbdf.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#define FTBDF_H_

#include <ft2build.h>
#include FT_FREETYPE_H
#include <freetype/freetype.h>

#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
Expand Down
4 changes: 2 additions & 2 deletions include/freetype/ftbitmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@


#include <ft2build.h>
#include FT_FREETYPE_H
#include FT_COLOR_H
#include <freetype/freetype.h>
#include <freetype/ftcolor.h>

#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
Expand Down
2 changes: 1 addition & 1 deletion include/freetype/ftbzip2.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#define FTBZIP2_H_

#include <ft2build.h>
#include FT_FREETYPE_H
#include <freetype/freetype.h>

#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
Expand Down
2 changes: 1 addition & 1 deletion include/freetype/ftcache.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@


#include <ft2build.h>
#include FT_GLYPH_H
#include <freetype/ftglyph.h>


FT_BEGIN_HEADER
Expand Down
2 changes: 1 addition & 1 deletion include/freetype/ftcid.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#define FTCID_H_

#include <ft2build.h>
#include FT_FREETYPE_H
#include <freetype/freetype.h>

#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
Expand Down
2 changes: 1 addition & 1 deletion include/freetype/ftcolor.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#define FTCOLOR_H_

#include <ft2build.h>
#include FT_FREETYPE_H
#include <freetype/freetype.h>

#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
Expand Down
Loading

0 comments on commit e133913

Please sign in to comment.