Commit Graph

61 Commits

Author SHA1 Message Date
Werner Lemberg d0cfb4e1b2 Update all copyright notices. 2022-01-11 10:54:10 +01:00
Alexei Podtelezhnikov a156040600 [builds/unix, builds/vms] Standardize `mmap` failure.
* builds/unix/ftsystem.c (FT_Stream_Open): Check for MAP_FAILED.
* builds/vms/ftsystem.c (FT_Stream_Open): Ditto.

This should cover https://savannah.nongnu.org/patch/?5909 as well.
2021-10-05 14:19:06 -04:00
Alexei Podtelezhnikov b4dddd8244 [base] Initialize stream memory earlier.
With Windows memory management tracking heap, it is important to use
it during the stream opening fallback. In Unix, the argument is
unused, but it is better to set it correctly.

* src/base/ftobjs.c (FT_Stream_New): Set memory before calling
`FT_Stream_Open`.
* builds/windows/ftsystem.c, builds/unix/ftsystem.c (FT_Stream_Open,
ft_close_stream_by_free): Call `ft_alloc` and `ft_free` with proper
memory argumment.
2021-09-22 00:30:03 -04:00
Alexei Podtelezhnikov 612925ff22 s/0/NULL/ where appropriate. 2021-09-01 21:37:21 -04:00
Werner Lemberg 689402418f builds/{unix,windows}/ftsystem.c: Sync comments with `src/base/ftsystem.c`.
Also some minor code formatting.
2021-02-02 09:44:42 +01:00
Werner Lemberg b6e8a71266 Update all copyright notices. 2021-01-17 07:18:48 +01:00
David Turner 66978a5887 Add Meson build project file.
Example usage:

  # Configure Meson build in directory `build-meson` to generate
  # release binaries comparable to to the ones from the
  # autotools/make build system.
  meson setup build-meson \
        --prefix=/usr/local \
        --buildtype=debugoptimized \
        --strip \
        -Db_ndebug=true

  # After configuring the Meson build with the above command,
  # compile and install to `/usr/local/`; this includes a pkg-config
  # file.
  ninja -C build-meson install

  # Alternatively, compile and install to `/tmp/aa/usr/local/...`
  # for packaging.
  DESTDIR=/tmp/aa ninja -C build-meson install

  # Generate documentation under `build-meson/docs`.
  ninja -C build-meson docs

Library size comparison for stripped `libfreetype.so` generated by
all three build systems:

  - Default build (autotools + libtool): 712 KiB
  - CMake build (RelWithDebInfo):        712 KiB
  - Meson build:                         712 KiB

* meson.build: New top-level Meson build file for the library.

* meson_options.txt: New file.  It holds user-selectable options for
the build, which can be printed with `meson configure`, and selected
at `meson setup` or `meson --reconfigure` time with
`-D<option>=<value>`.

* scripts/parse_modules_cfg.py: A script invoked by `meson.build` to
parse `modules.cfg` and extract important information out of it
(i.e., the list of modules).

* scripts/process_ftoption_h.py: New script invoked by `meson.build`
to process the original `ftoption.h` file.  It enables or disables
configuration macro variables based on the available dependencies.
This is similar to what other build systems are using (i.e., Meson's
`configure_file()` command is not used here).

* scripts/extract_freetype_version.py: New script invoked by
`meson.build` to extract the FreeType version number from
`<freetype/freetype.h>`.

* scripts/extract_libtool_version.py: New script invoked by
`meson.build` to extract the libtool `revision_info` data from
`builds/unix/configure.raw`, and to generate the corresponding
shared library suffix.

* scripts/generate_reference_docs.py: New script invoked by
`meson.build` to generate the FreeType 2 reference documentation
(using the `docwriter` and `mkdocs` packages, which must be already
installed).
2020-09-21 07:53:02 +02:00
Priyesh Kumar 53be1753de Fix `-Wformat' compiler warnings.
* src/*: Fix format specifiers.

* builds/unix/ftsystem.c (FT_Stream_Open): Ditto.
2020-07-28 07:33:40 +02:00
David Turner e13391333f 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-08 13:31:55 +02:00
Werner Lemberg e5038be704 Update all copyright notices. 2020-01-19 17:05:19 +01:00
Werner Lemberg 7585997024 Update all copyright notices. 2019-02-23 10:07:09 +01:00
Werner Lemberg f686ad46a3 Update copyright years. 2019-01-22 20:31:44 +01:00
Alexei Podtelezhnikov d71f2bc159 Revert "Align FreeType with standard C memory management."
This reverts commit 877aa1b2cc.
2018-10-26 22:52:25 -04:00
Alexei Podtelezhnikov 877aa1b2cc Align FreeType with standard C memory management.
* include/freetype/ftsystem.h: Include FT_TYPES_H.
(*FT_Alloc_Func, *FT_Realloc_Func): Use size_t for the size arguments.
* src/raster/ftmisc.h: Ditto.

* builds/amiga/src/base/ftsystem.c, builds/unix/ftsystem.c,
* builds/vms/ftsystem.c, src/base/ftsystem.c (ft_alloc, ft_realloc):
Use size_t for the size arguments.

* src/base/ftdbgmem.c (ft_mem_debug_alloc, ft_mem_debug_realloc): Use
FT_Offset, aka size_t, for the size arguments.
2018-09-27 21:17:36 -04:00
Werner Lemberg 33cd1eedcf * builds/*/ftsystem.c (FT_COMPONENT): Updated also. 2018-08-16 05:55:18 +02:00
Werner Lemberg 0a0c22569d Update copyright year. 2018-01-02 09:33:57 +01:00
Werner Lemberg 563ae78022 Update copyright year. 2017-01-04 20:16:34 +01:00
Werner Lemberg 9adeab6452 Update copyright year. 2016-01-13 11:54:10 +01:00
Werner Lemberg f57fc59e01 Run `src/tools/update-copyright'. 2015-01-17 20:41:43 +01:00
Werner Lemberg a44b784bca Formatting. 2013-12-02 09:52:38 +01:00
Werner Lemberg fae3820764 Simplify header file hierarchy.
This large patch changes the header file directory layout from
`include/freetype/...' to `include/...', effectively removing one
level.  Since the file `ft2build.h' is also located in `include'
(and it stays there even after installation), all FreeType header
files are now in a single directory.

Applications that use (a) `freetype-config' or FreeType's
`pkg-config' file to get the include directory for the compiler, and
(b) the documented way for header inclusion like

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

don't need any change to the source code.

* include/freetype/*: Move up to...
* include/*: ... this directory.

* builds/amiga/include/freetype/*: Move up to...
* builds/amiga/include/*: ... this directory.

*/*: Essentially do `s@/freetype/@/@' where appropriate.

* CMakeList.txt: Simplify.
* builds/unix/freetype-config.in, builds/unix/freetype2.in: For
`--cflags', return a single directory.
* builds/unix/install.mk (install): No longer try to remove `cache'
and `internal' subdirectories; instead, remove the `freetype'
subdirectory.
2013-11-13 08:55:46 +01:00
Werner Lemberg fd66469eba Update more FT_Err_XXX macros using FT_ERR and FT_THROW;
* builds/amiga/src/base/ftsystem.c, builds/mac/ftmac.c,
builds/unix/ftsystem.c, builds/vms/ftsystem.c: Do it.
2013-05-17 17:40:27 +02:00
Suzuki, Toshiya (鈴木俊哉) a7c5de592c * builds/unix/ftsystem.c: Fix 2 error messages ending without LINEFEED 2009-01-22 04:00:32 +00:00
Werner Lemberg 66043b1c4f * builds/unix/ftsystem.c (FT_Stream_Open): Reject zero-length files.
Patch from Savannah bug #25151.
2008-12-22 18:09:48 +00:00
Werner Lemberg cb37b3b36a * builds/unix/ftsystem.c (FT_Stream_Open): Don't use ULONG_MAX but
LONG_MAX to avoid compiler warning.  Suggested by Sean McBride.
2007-06-01 06:49:03 +00:00
Werner Lemberg 5077e83e11 * builds/unix/ftsystem.c (FT_Stream_Open): Handle return value 0 of
mmap (which might happen on some RTOS).  From Savannah patch #5909.
2007-05-04 06:13:46 +00:00
Werner Lemberg 14ffe0911f formatting 2007-03-22 06:12:43 +00:00
Suzuki, Toshiya (鈴木俊哉) dabf0535a8 Temporal fix for 32bit unsigned long overflow on LP64 platform 2007-03-22 05:23:53 +00:00
Yamato, Masatake (大和正武) 28b55a9bb6 (FT_Stream_Open): Check errno only if read system call returns -1.
Remove a redundant parenthesis.
2006-05-11 03:01:42 +00:00
Werner Lemberg b80d85fe9e * builds/unix/ftsystem.c (FT_Stream_Open): Avoid infinite loop if
given an empty, un-mmap()able file.  Reported and suggested fix in
Savannah bug #16555.
2006-05-10 04:47:35 +00:00
Werner Lemberg 7f049f4221 Formatting, copyright years. 2006-02-25 16:52:16 +00:00
David Turner de271ab8f0 * builds/unix/ftsystem.c, include/freetype/config/ftheader.h,
include/freetype/internal/services/svotval.h,
    include/freetype/internal/services/svpfr.h,
    src/base/ftsystem.c, src/bdf/bdfdrivr.c, src/cache/ftcbasic.c,
    src/cff/cffcmap.c, src/gzip/ftgzip.c, src/lzw/ftlzw.c,
    src/lzw/ftlzw2.c, src/psaux/t1cmap.c, src/sfnt/ttbdf.c,
    src/smooth/ftgrays.c:

       solved -Wmissing-prototypes warnings with GCC
2006-02-25 14:53:02 +00:00
Werner Lemberg 1a293d6c73 * src/sfnt/ttload.c (tt_face_load_metrics): Ignore excess number
of metrics instead of aborting.  Patch suggested by Derek Noonburg.
2005-11-18 08:23:06 +00:00
Wu, Chia-I (吳佳一) cb18238109 * builds/unix/ftsystem.c (FT_Stream_Open, FT_New_Memory,
FT_Done_Memory), builds/vms/ftsystem.c (FT_Stream_Open, FT_New_Memory,
FT_Done_Memory), builds/win32/ftdebug.c (FT_Message, FT_Panic):
s/FT_EXPORT/FT_BASE/.
2005-11-18 04:29:31 +00:00
David Turner 9fbd2ab884 - various performance enhancements
- fixing apinames.c, adding support for Watcom and Borland compilers
- adding generation of exported symbols list to the build system, including the Unix one !!

sorry Werner, I have no time to document this in ChangeLog at the moment
2005-10-28 16:14:14 +00:00
Werner Lemberg cc7cab815c * builds/unix/ftsystem.c (FT_Stream_Open): Add proper cast for
ft_alloc.
Fix compiler warning.
2004-12-28 23:08:51 +00:00
Werner Lemberg d1d2b458e9 * builds/unix/ftsystem.c: Include errno.h.
(ft_close_stream): Renamed to...
(ft_close_stream_by_munmap): This.
(ft_close_stream_by_free): New function.
(FT_Stream_Open): Use fallback method if mmap fails.
Use proper function for closing the stream.

* src/type1/t1load.c (parse_dict): Initialize `start_binary'.
2004-02-16 09:38:05 +00:00
Werner Lemberg b1e6e59782 * builds/vms/ftconfig.h: Rename LOCAL_DEF and LOCAL_FUNC to
FT_LOCAL and FT_LOCAL_DEF, respectively, as with other ftconfig.h
files.
* builds/unix/ftconfig.in: Add argument to FT_LOCAL and
FT_LOCAL_DEF.
* src/truetype/ttinterp.c: s/FT_Assert/FT_ASSERT/.
* builds/unix/configure.ac: Temporarily deactivate creation of
../../Jamfile.
* builds/unix/configure: Updated.
2002-03-29 07:43:04 +00:00
David Turner 53b3fa1da5 * renaming stream functions to the FT_Subject_Action scheme:
FT_Seek_Stream         => FT_Stream_Seek
          FT_Skip_Stream         => FT_Stream_Skip
          FT_Read_Stream         => FT_Stream_Read
          FT_Read_Stream_At      => FT_Stream_Read_At
          FT_Access_Frame        => FT_Stream_Enter_Frame
          FT_Forget_Frame        => FT_Stream_Exit_Frame
          FT_Extract_Frame       => FT_Stream_Extract_Frame
          FT_Release_Frame       => FT_Stream_Release_Frame
          FT_Get_XXXX            => FT_Stream_Get_XXXX
          FT_Read_XXXX           => FT_Stream_Read_XXXX

          note also that:

          FT_New_Stream( filename, stream ) =>
            FT_Stream_Open( stream, filename )

          (the function doesn't create the FT_Stream structure, it simply
           initializes it for reading)

          FT_New_Memory_Stream( library, FT_Byte*  base, size, stream ) =>
            FT_Stream_Open_Memory( stream, const FT_Byte* base, size )

          FT_Done_Stream => FT_Stream_Close

          note that the name of the stream methods, defined in
          "include/freetype/ftsystem.h" have also been changed without
          problems:

            FT_Stream_IO    => FT_Stream_IOFunc
            FT_Stream_Close => FT_Stream_CloseFunc
2002-02-24 05:26:57 +00:00
David Turner 7fe38a5124 remove compiler warnings and a typo in builds/unix/ftsystem.c 2002-01-04 09:47:30 +00:00
Werner Lemberg 1a0a97938a * src/type1/t1objs.c (T1_Face_Init): Add cast to avoid compiler
warning.
2002-01-03 22:06:13 +00:00
David Turner c48bf37bda * builds/unix/ftsystem.c (FT_New_Stream): added a fix to ensure that
all FreeType input streams are closed in child processes of a "fork"
        on Unix systems. This is important to avoid (potential) access
        control issues..
2002-01-03 17:08:20 +00:00
Tom Kacvinsky 7bb9276686 In function FT_New_Memory, added a missing `}'. 2001-10-24 14:43:40 +00:00
David Turner 5a1de37e7e replaced liberal uses of "memset" by the "MEM_Set" macro call
(some platforms don't provide this ANSI function !!)

some changes to "ftsystem.c" implementations in order to use
the new memory debugger on Unix, VMS and Amiga too !!
2001-10-24 07:32:55 +00:00
Werner Lemberg 415235df1b finishing function header formatting
updating copyrights
2001-06-28 17:49:10 +00:00
Werner Lemberg 4a2305cf0c formatting 2001-06-28 07:17:51 +00:00
Werner Lemberg f814d0fafe First round in converting
type foo ( ... )

to

  type
  foo ( ... )

Other minor formatting issues.
2001-06-27 16:18:10 +00:00
David Turner dee781342b * include/freetype/ftconfig.h, src/*/*.c: changed the definition and
uses of the FT_CALLBACK_DEF macro in order to support 16-bit compilers
2001-06-27 09:26:46 +00:00
Werner Lemberg 6b41954e18 * builds/unix/ftsystem.c: Fixed typos. Fixed inclusion of wrong
ftconfig.h file.
2000-12-13 09:21:59 +00:00
Werner Lemberg d5c1b27d58 * include/freetype/config/ft2build.h (FT2_ROOT, FT2_CONFIG_ROOT):
Removed.  ANSI C doesn't (explicitly) allow macro expansion in
arguments using `##'.
(FT2_PUBLIC_FILE, FT2_CONFIG_FILE, FT2_INTERNAL_FILE): Use directory
names directly.  Make them configurable.  Use `##' to strip leading
and trailing spaces from arguments.

* builds/unix/ft2unix.h: Adapted.

* src/base/ftsystem.c (ft_alloc, ft_realloc, ft_free, ft_io_stream,
ft_close_stream): Use FT_CALLBACK_DEF.

* builds/unix/ftsystem.c: Use new header scheme.
(FT_Done_Memory): Use free() from FT_Memory structure.

* src/base/ftinit.c, src/base/ftmac.c: Header scheme fixes.

* include/freetype/config/ft2build.h (FT2_CONFIG_ROOT,
FT2_PUBLIC_FILE, FT2_CONFIG_FILE, FT2_INTERNAL_FILE,
FT_SOURCE_FILE): Use `##' operator to be really ANSI C compliant.
2000-12-12 22:28:12 +00:00