Commit Graph

49 Commits

Author SHA1 Message Date
Werner Lemberg d0cfb4e1b2 Update all copyright notices. 2022-01-11 10:54:10 +01:00
Werner Lemberg b6e8a71266 Update all copyright notices. 2021-01-17 07:18:48 +01:00
Werner Lemberg 1658685967 Remove redundant inclusion of `ft2build.h'.
* */*: Remove `#include <ft2build.h>' where possible.

* include/freetype/freetype.h: Remove cpp error about missing
inclusion of `ft2build.h'.
2020-06-13 21:15:45 +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
Werner Lemberg a0dd16fb3d Don't use `trace_' prefix for FT_COMPONENT arguments.
* include/freetype/internal/ftdebug.h (FT_TRACE_COMP,
FT_TRACE_COMP_): New auxiliary macros to add `trace_' prefix.
(FT_TRACE): Use `FT_TRACE_COMP'.

*/* (FT_COMPONENT): Updated.
2018-08-15 18:13:17 +02:00
Werner Lemberg 580c94d8f7 Fix minor ASAN run-time warnings.
* src/base/ftutil.c (ft_mem_alloc, ft_mem_realloc): Only call
`FT_MEM_ZERO' if we actually have a buffer.
(ft_mem_dup): Only call `ft_memcpy' if we actually have a buffer.
2018-07-25 07:03:07 +02:00
Werner Lemberg 9ac9060df0 [GSoC] src/*.*: Convert block comments to `light' style.
This monster commit was created by applying Nikhil's scripts
`docconverter.py' and `markify.py' to all C header and source files,
followed up by minor manual clean-up.

No change in functionality, of course.

I used commit f7419907bc6044b9b7057f9789866426c804ba82 from
https://github.com/nikramakrishnan/freetype-docs.git.
2018-06-03 09:08:41 +02:00
Werner Lemberg 0a0c22569d Update copyright year. 2018-01-02 09:33:57 +01:00
Werner Lemberg bd28952e23 [base] Don't zero out allocated memory twice (#51816).
Patch applied from bug report.

* src/base/ftutil.c (ft_mem_qrealloc): Use low-level allocation to
avoid unnecessary overhead.
2017-08-22 08:41:03 +02:00
Werner Lemberg 563ae78022 Update copyright year. 2017-01-04 20:16:34 +01:00
Werner Lemberg 4441f7b246 Replace `foo == NULL' and `foo != NULL' with `!foo' and `foo', resp.
Other minor formatting.
2016-12-26 17:08:17 +01:00
Werner Lemberg 9adeab6452 Update copyright year. 2016-01-13 11:54:10 +01:00
Alexei Podtelezhnikov 9de55e0355 [base] NULL. 2015-04-10 23:45:11 -04:00
Werner Lemberg 2e814fc045 More minor signedness warning fixes.
* src/base/ftbbox.c, src/base/ftbitmap.c, src/base/fttrigon.c,
src/base/ftutil.c: Apply.
2015-02-16 20:05:08 +01:00
Werner Lemberg f57fc59e01 Run `src/tools/update-copyright'. 2015-01-17 20:41:43 +01:00
Werner Lemberg f34f192535 * src/*: Add checks for parameters of API functions where missing.
`API functions' are functions tagged with `FT_EXPORT_DEF'.

Besides trivial fixes, the following changes are included, too.

* src/base/ftbdf.c (FT_Get_BDF_Charset_ID, FT_Get_BDF_Property): Set
error code if no service is available.

* src/base/ftinit.c (FT_Done_FreeType): Change return value for
invalid `library' parameter to `Invalid_Library_Handle'.

* src/base/ftobjs.c (FT_New_Size): Change return value for invalid
`asize' parameter to `Invalid_Argument'.

* src/base/ftoutln.c (FT_Outline_Copy): Change return value for
invalid `source' and `target' parameters to `Invalid_Outline'.
(FT_Outline_Done_Internal): Change return value for invalid
`outline' parameter to `Invalid_Outline'.
2014-11-26 21:59:21 +01:00
Alexei Podtelezhnikov c0a6f20a4b Replace `ft_highpow2' function.
* src/pfr/pfrobjs.c (pfr_face_get_kerning): Use `FT_MSB' instead of
`ft_highpow2'.

* src/base/ftutil.c, include/internal/ftobjs.h (ft_highpow2): Remove
it.
2014-07-16 22:05:56 -04:00
Werner Lemberg f6aa089f12 */* [FT_CONFIG_OPTION_OLD_INTERNALS]: Remove macro and guarded code. 2013-05-10 07:58:47 +02:00
Werner Lemberg 059bc335ce */*: Use `FT_THROW'.
This is essentially a mechanical conversion, adding inclusion of
`FT_INTERNAL_DEBUG_H' where necessary, and providing the macros for
stand-alone compiling modes of the rasterizer modules.

To convert the remaining occurrences of FT_Err_XXX and friends it is
necessary to rewrite the code.  Note, however, that it doesn't harm
if some cases are not handled since FT_THROW is a no-op.
2013-03-14 10:27:35 +01:00
David Turner 3a51afac36 fixing implementation bug in ft_mem_strcpyn 2007-03-08 10:50:38 +00:00
Werner Lemberg 442bfb8913 Formatting, copyright years, s/memcpy/ft_memcpy/. 2007-02-12 21:44:10 +00:00
David Turner c0f9c4aadd introduce ft_mem_dup, ft_mem_strdup and ft_mem_strcpyn, and the corresponding
macros to use them (e.g. FT_STRDUP, FT_DUP and FT_STRCPYN)

modify the code to use them instead of raw mallocs/strcpy
2007-02-12 14:55:03 +00:00
Werner Lemberg d724f20e05 formatting 2006-06-04 15:17:41 +00:00
David Turner ea4547ca03 * src/base/ftutil.c (ft_mem_qrealloc): fix the function
to accept 'item_size == 0' as well, though this sounds
  weird, it can theorically happen.

  see bug #16669
2006-06-04 14:50:57 +00:00
Werner Lemberg c6afa1221a * include/freetype/internal/ftmemory.h: s/new/newsz/ (for C++).
(FT_ALLOC): Remove redundant redefinition.

* builds/compiler/gcc-dev.mk (CFLAGS) [g++]: Don't use
`-Wstrict-prototypes'.

* src/base/ftstream.c (FT_Stream_EnterFrame): Add cast.

Formatting, copyright years.
2006-05-02 22:22:16 +00:00
David Turner 264f307e66 * include/freetype/fterrdef.h, include/freetype/config/ftconfig.h,
include/freetype/internal/ftmemory.h, src/base/ftdbgmem.c,
    src/base/ftutil.c: udpating the memory management functions and
    macros to safely deal with array size buffer overflows, this
    corresponds to attemps to allocate arrays that are too large. For
    an example, consider the following code:

         count = read_uint32_from_file();
         array = malloc( sizeof(Item) * count );
         for ( nn = 0; nn < count; nn++ )
           array[nn] = read_item_from_file();

    if 'count' is larger than FT_UINT_MAX/sizeof(Item), the multiplication
    will overflow and the array allocated will be smaller than the data
    read from the file. In this case, the heap will be trashed, and this
    can be used as a denial-of-service, or make the engine crash later.

    the FT_ARRAY_NEW and FT_ARRAY_RENEW macro now check that the new
    count is no more than FT_INT_MAX/item_size, otherwise, a new error,
    named 'FT_Err_Array_Too_Large' will be returned.

    note that the memory debugger now works again when FT_DEBUG_MEMORY
    is defined, and FT_STRICT_ALIASING has disappeared, the corresponding
    code being now the default.
2006-05-02 06:34:27 +00:00
Wu, Chia-I (吳佳一) 9f5d3de3f0 * src/base/ftutil.c (ft_mem_qalloc) [FT_STRICT_ALIASING]: Do not
return error if size == 0.
2006-02-28 13:21:50 +00:00
Werner Lemberg 422d2a052a formatting, copyright years 2006-02-27 18:25:22 +00:00
David Turner c13e75fb1b * src/base/ftutil.c: ft_mem_alloc and related functions now return an
error if a negative size is passed in parameters.

    * src/cache/ftccache.c: make ftc_node_destroy FT_BASE_DEF, it needs to
    be exported for rogue clients

    * src/pshinter/pshglob.c: prevent problems with malformed fonts which
    have an odd number of blue values (these are broken according to the
    specs).

    * src/cff/cffload.c, src/type1/t1load.c: modify the loaders to force
    even-ness of 'num_blue_values'. Also change the CFF loader so that
    invalid entries in index files are ignored.
2006-02-27 13:14:42 +00:00
David Turner 6c71c6b968 * include/freetype/config/ftoption.h, src/autofit/afcjk.c,
src/base/ftobjs.c, src/base/ftutil.c, src/cff/cffobjs.c,
    src/psaux/afmparse.c, src/sfnt/ttbdf.c, src/tools/apinames.c,
    src/truetype/ttdriver.c:

       solved compiler warnings as well as C++ compilation problems
2006-02-25 12:49:40 +00:00
Werner Lemberg 8e6f8c4d79 Formatting, copyright years, documentation improvements. 2006-02-17 08:07:09 +00:00
David Turner cda2d957dc * builds/amiga/src/base/ftsystem.c, devel/ftoption.h
include/freetype/ftcache.h, include/freetype/ftoutln.h,
      include/freetype/cache/ftccache.h, include/freetype/cache/ftccmap.h,
      include/freetype/config/ftoption.h, include/freetype/internal/ftcalc.h,
      include/freetype/internal/ftdriver.h,
      include/freetype/internal/ftmemory.h,
      include/freetype/internal/ftobjs.h, include/freetype/internal/ftrfork.h,
      include/freetype/internal/psaux.h, include/freetype/internal/sfnt.h,
      include/freetype/internal/t1types.h, include/freetype/internal/tttypes.h,
      src/base/ftcalc.c, src/base/ftdbgmem.c, src/base/ftobjs.c,
      src/base/ftsystem.c, src/base/ftutil.c, src/bdf/bdfdrivr.c,
      src/cache/ftccache.c, src/cache/ftccback.h, src/cache/ftccmap.c,
      src/cache/ftcmanag.c, src/cff/cffdrivr.c, src/cid/cidriver.c,
      src/pcf/pcfdrivr.c, src/pfr/pfrdrivr.c, src/psaux/psauxmod.c,
      src/sfnt/sfdriver.c, src/truetype/ttdriver.c, src/type1/t1driver.c,
      src/type1/t1objs.c, src/type42/t42drivr.c, src/winfonts/winfnt.c:

    massive changes to the internals to respect the internal object layouts
    and exported functions of FreeType 2.1.7. Note that the cache sub-system
    cannot be fully retrofitted, unfortunately.
2006-02-16 22:45:31 +00:00
Werner Lemberg be3c9814a4 Formatting, copyright years. 2006-01-27 14:16:16 +00:00
David Turner 6a681fa84a * src/autofit/afwarp.c: simple #ifdef to prevent compilation when
the warp hinter isn't active (it shouldn't, still experimental)

    * Jamfile, include/freetype/config/ftmodule.h: removed "gxvalid"
    and "otvalid" from the list of modules that are linked statically
    to a given FreeType library. Functionality has been moved to the
    "ftvalid" CVS module.

    note also that current Make-based build system still compiles the
    modules though...

    * include/freetype/config/ftoption.h: added FT_STRICT_ALIASING,
    which controls the definitions of the memory management functions
    to avoid warnings with recent versions of GCC. this macro is
    only here to be disabled, in case we detect problems with the
    new scheme.

    NOTE: disable macro to use the memory debugger. this will be fixed
          later !!
2006-01-27 12:11:22 +00:00
Werner Lemberg 30bd284447 * src/base/ftutil.c (ft_highpow2): s/FT_BASE/FT_BASE_DEF/.
Reported by Niels Boldt <nielsboldt@gmail.com>.
2006-01-08 19:38:42 +00:00
Werner Lemberg baa662bbea * src/base/ftutil.c: Include FT_INTERNAL_OBJECTS_H. 2005-03-03 23:05:29 +00:00
David Turner 683973b47c * include/freetype/internal/ftobjs.h, src/base/ftutil.c (ft_highpow2),
src/pfr/pfrload.c, src/pfr/pfrobjs.c, src/pfr/pfrtypes.h: implement
    FT_OPTIMIZE_MEMORY, the kerning table is not loaded into the heap
    anymore.
2005-03-03 14:00:23 +00:00
Werner Lemberg ece8b20e6c Documentation updates, whitespace. 2004-12-13 23:16:59 +00:00
Werner Lemberg 21ddf945c3 * include/freetype/internal/ftmemory.h [FT_DEBUG_MEMORY]: Declare
FT_QAlloc_Debug and FT_QRealloc_Debug.

* src/base/ftutil.c (FT_QAlloc): Fix error and debug messages.
(FT_QRealloc): Call FT_QAlloc if original pointer is NULL.
Fix error message.
2004-06-24 06:56:06 +00:00
David Turner 5290d2fb46 performance optimizations regarding face opening 2004-06-23 15:44:03 +00:00
Werner Lemberg b3d5e9cf03 s/ft_memset/FT_MEM_SET/.
s/FT_MEM_SET/FT_MEM_ZERO/ where appropriate.
2002-07-28 05:05:24 +00:00
Werner Lemberg f8ba2005ab * include/freetype/t1tables.h (t1_blend_max): Fix typo.
* src/base/ftstream.c: Simplify FT_ERROR calls.

formatting, copyright update
2002-03-30 13:16:35 +00:00
David Turner e459d742e6 * include/freetype/internal/ftmemory.h, and a lot of other files !!:
changed the names of memory macros. Examples:

              MEM_Set   => FT_MEM_SET
              MEM_Copy  => FT_MEM_COPY
              MEM_Move  => FT_MEM_MOVE

              ALLOC     => FT_ALLOC
              FREE      => FT_FREE
              REALLOC   = >FT_REALLOC

            FT_NEW was introduced to allocate a new object from a _typed_
            pointer..

            note that ALLOC_ARRAY and REALLOC_ARRAY have been replaced
            by FT_NEW_ARRAY and FT_RENEW_ARRAY which take _typed_ pointer
            arguments.

            This results in _lots_ of sources being changed, but makes the
            code more generic and less error-prone..
2002-03-22 13:52:37 +00:00
Werner Lemberg 4ef4bdf066 * src/base/ftutil.c (FT_Realloc): Use MEM_Set instead of memset. 2002-03-07 23:22:28 +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 c919c7d461 adding new file 2002-02-22 14:40:12 +00:00