Commit Graph

101 Commits

Author SHA1 Message Date
Werner Lemberg 695d606ae5 Whitespace. 2022-04-01 08:50:33 +02:00
Alexei Podtelezhnikov 983d435865 [cache] Fix fallouts from edd4fedc54.
Reported by Werner.

* src/cache/ftcimage.c (FTC_INode_New): Always initialize FT_Glyph.
* src/cache/ftcsbits.c (FTC_SNode_New): Always initialize FT_SBit.
2022-01-30 22:13:51 -05:00
Alexei Podtelezhnikov edd4fedc54 [cache] Avoid unnecessary zeroing.
* src/cache/ftccmap.c (ftc_cmap_node_new): Use `FT_QNEW`.
* src/cache/ftcimage.c (FTC_INode_New): Ditto.
* src/cache/ftcsbits.c (FTC_SNode_New): Ditto.
2022-01-14 22:53:57 -05:00
Werner Lemberg d0cfb4e1b2 Update all copyright notices. 2022-01-11 10:54:10 +01:00
Alexei Podtelezhnikov fce74b7365 [cache] Miscellaneous clean-ups.
* src/cache/ftccache.c (ftc_get_top_node_for_hash, FTC_Cache_Clear):
Remove barely used variables.
(ftc_cache_add): Adjust casting.
* src/cache/ftccmap.c (FTC_CMapCache_Lookup): Remove casting.
* src/cache/ftcsbits.c (ftc_snode_load): Remove casting.
2021-09-16 17:03:19 -04:00
Werner Lemberg a50c39aa8e Fix compilation errors and (some) warnings for clang++.
* src/autofit/afmodule.c (AF_GlyphHintsRec): Make it static.

* src/cache/ftcache.c (FTC_Cache_NewNode), src/cache/ftcsbits.c
(ftc_snode_compare): Remove semicolon.

* src/cff/cffparse.c (cff_parser_run): Add `break` statement.

* src/cid/cidload.c (cid_hex_to_binary): Add cast.

* src/sdf/ftbsdf.c (CHECK_NEIGHBOR): Use `do {} while(0)` loop.
(bsdf_init_distance_map, finalize_sdf, bsdf_raster_render): Add
casts.
* src/sdf/ftsdf.c (sdf_generate_bounding_box,
sdf_generate_with_overlaps): Ditto.
* src/sdf/ftsdfcommon.h (square_root): Ditto.
* src/sdf/ftsdfrend.c (sdf_property_get, ft_sdf_render,
ft_bsdf_render): Ditto.

* src/sfnt/ttcolr.c (find_base_glyph_record,
find_base_glyph_v1_record): Fix variable signedness.
(read_color_line): Add cast.
(read_paint): Add casts.
Fix signedness issue.
(tt_face_get_colorline_stops) Fix signedness issues.

* src/sfnt/ttpost.c (load_format_20): Add casts.

* src/truetype/ttsubpix.c (TWEAK_RULES, TWEAK_RULES_EXCEPTIONS):
Remove final semicolons.
2021-05-29 09:51:04 +02:00
Alexei Podtelezhnikov 23f85c8a98 [cache] Optimize SBit copying.
* src/cache/ftcsbits.c (ftc_snode_load): Do not initialize the buffer.
(ftc_sbit_copy_bitmap): Accept zero size, s/FT_ALLOC/FT_QALLOC/.
2021-04-22 23:34:08 -04:00
Alexei Podtelezhnikov 8a459e5172 [cache] Restore SBit copying for unowned (BDF) bitmaps.
* src/cache/ftcsbits.c (ftc_sbit_copy_bitmap): Restore.
(ftc_snode_load): Check ownership and copy unowned bitmaps.
2021-04-20 22:53:13 -04:00
Alexei Podtelezhnikov 7c685cb3f6 [cache] Switch to lazy SBit setting.
* src/cache/ftcsbits.c (ftc_sbit_copy_bitmap): Removed.
(ftc_snode_load): Take the bitmap ownership instead of copying.
2021-04-18 22:31:13 -04:00
Daniel Welty 2e68785e08 * src/cache/ftcsbits.c (ftc_snode_load): Properly handle short pitch. 2021-04-17 09:00:40 -04: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 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 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 0d053bac84 Fix runtime errors found by clang's sanitizer (#47082).
* src/base/ftobjs.c (FT_Render_Glyph_Internal), src/base/ftoutln.c
(FT_Outline_Copy), src/cache/ftcsbits.c (ftc_sbit_copy_bitmap):
Properly handle empty input buffer.
2016-02-07 19:25:56 +01:00
Werner Lemberg 9adeab6452 Update copyright year. 2016-01-13 11:54:10 +01:00
Werner Lemberg 2e9d2660b3 Don't use macro names that contain `__' [2/2].
Such macro names are reserved for both C and C++.

* src/cache/*: s/__/_/.
2016-01-12 21:40:53 +01:00
Werner Lemberg 24e4e96aff [cache] Signedness fixes.
* src/cache/ftcbasic.c, src/cache/ftccmap.c, src/cache/ftcimage.c,
src/cache/ftcmanag.c, src/cache/ftcsbits.c: Apply.
2015-02-25 07:55:51 +01:00
Werner Lemberg f57fc59e01 Run `src/tools/update-copyright'. 2015-01-17 20:41:43 +01:00
Werner Lemberg b3500af717 Change some fields in `FT_Bitmap' to unsigned type.
This doesn't break ABI.

* include/ftimage.h (FT_Bitmap): Make `rows', `width', `num_grays',
`pixel_mode', and `palette_mode' unsigned types.

* src/base/ftbitmap.c: Updated.
(FT_Bitmap_Copy): Fix casts.

* src/cache/ftcsbits.c, src/raster/ftraster.c, src/sfnt/pngshim.c:
Updated.
2014-11-21 06:38:46 +01:00
Werner Lemberg 89f5064765 */*: Use FT_ERR_EQ, FT_ERR_NEQ, and FT_ERR where appropriate.
FT_Err_XXX and friends are no longer directly used in the source
code.
2013-03-14 17:50:49 +01:00
Werner Lemberg e3c9301581 */*: Use FT_Err_Ok only.
This is a purely mechanical conversion.
2013-03-14 11:21:17 +01: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
Werner Lemberg 3757b1e1c1 Cleanup/formatting. 2011-01-13 10:33:04 +01:00
suzuki toshiya 38b272ffbb [cache] Notice if a cache query induced the node list change.
Some node comparators (comparing the cache node content and
the properties specified by the query) can flush the cache
node to prevent the cache inflation.  The change may
invalidate the pointers to the node obtained before the node
comparison, so the change should be noticed to the caller.
The problem caused by the cache node changing is reported by
Harsha, see Savannah bug #31923.

* src/cache/ftccache.h (FTC_Node_CompareFunc): Add new
argument `FT_Bool* list_changed' to indicate the change of
the cached nodes to the caller.
(FTC_CACHE_LOOKUP_CMP): Watch the change of the cached nodes
by `_list_changed'.
(FTC_CACHE_TRYLOOP_END): Take new macro argument `_list_changed'
and update it when FTC_Manager_FlushN() flushes any nodes.

* src/cache/ftccback.h (ftc_snode_compare): Updated to fit
with new FTC_Node_CompareFunc type.  (ftc_gnode_compare): Ditto.

* src/cache/ftcbasic.c: Include FT_INTERNAL_OBJECTS_H to
use TRUE/FALSE macros.  (ftc_basic_gnode_compare_faceid):
New argument `FT_Bool* list_changed' to indicate the change
of the cache nodes, anyway, it is always FALSE.

* src/cache/ftccmap.c: Include FT_INTERNAL_OBJECTS_H to
use TRUE/FALSE macros.  (ftc_cmap_node_compare):
New argument `FT_Bool* list_changed' to indicate the change
of the cache nodes, anyway, it is always FALSE.
(ftc_cmap_node_remove_faceid): Ditto.

* src/cache/ftccache.c (FTC_Cache_NewNode): Pass a NULL
pointer to FTC_CACHE_TRYLOOP_END(), because the result is
not needed.  (FTC_Cache_Lookup): Watch the change of the cache
nodes by `list_changed'.  (FTC_Cache_RemoveFaceID): Ditto.

* src/cache/ftcglyph.c: Include FT_INTERNAL_OBJECTS_H to
use TRUE/FALSE macros.  (ftc_gnode_compare): New argument
`FT_Bool* list_changed' to indicate the change of the cache
nodes, anyway, it is always FALSE.  (FTC_GNode_Compare):
New argument `FT_Bool* list_changed' to be passed to
ftc_gnode_compare().
* src/cache/ftcglyph.h (FTC_GNode_Compare): Ditto.

* src/cache/ftcsbits.c (ftc_snode_compare): New argument
`FT_Bool* list_changed' to indicate the change of the cache
nodes, anyway. It is updated by FTC_CACHE_TRYLOOP().
(FTC_SNode_Compare): New argument `FT_Bool* list_changed'
to be passed to ftc_snode_compare().
* src/cache/ftcsbits.h (FTC_SNode_Compare): Ditto.
2011-01-09 22:52:24 +09:00
suzuki toshiya 52a1e47a5c [cache] inline-specific functions are conditionalized.
* src/cache/ftcglyph.c (FTC_GNode_Compare): Conditionalized
for inlined config.  This function is a thin wrapper of
ftc_gnode_compare() for inlined FTC_CACHE_LOOKUP_CMP()
(see `nodecmp' argument).  Under non-inlined config,
ftc_gnode_compare() is invoked by FTC_Cache_Lookup(),
via FTC_Cache->clazz.node_compare().

* src/cache/ftcglyph.h (FTC_GNode_Compare): Ditto.
* src/cache/ftcsbits.c (FTC_SNode_Compare): Ditto,
for ftc_snode_compare().
* src/cache/ftcsbits.h (FTC_SNode_Compare): Ditto.
2011-01-09 20:49:21 +09:00
Harsha 7774ac67ec Apply Savannah patch #7422.
If we encouter a space in a string then the sbit buffer is NULL,
height and width are 0s.  So the check in ftc_snode_compare will
always pass for spaces (comparision with 255).  Here the comments
above the condition are proper but the implementation is not.  When
we create an snode I think it is the proper way to initialize the
width to 255 and then put a check for being equal to 255 in snode
compare function.

* src/cache/ftcsbits.c (FTC_SNode_New): Initialize sbit widths with
value 255.
(ftc_snode_compare): Fix condition.
2010-12-25 16:34:56 +01:00
Werner Lemberg 6abb9232b6 Improve tracing messages.
* src/truetype/ttinterp.c (TT_RunIns): Improve wording of tracing
message.
* src/truetype/ttobjs.c (tt_size_run_fpgm, tt_size_run_prep): Add
tracing message.
* src/truetype/ttgload.c (tt_loader_init): Add tracing message.
* src/cache/ftcsbits.c (ftc_snode_load): Emit tracing message if
glyph doesn't fit into a small bitmap container.
2010-09-14 09:02:10 +02:00
Werner Lemberg f765e4403c */*: Use module specific error names where appropriate. 2010-06-24 10:34:29 +02:00
Werner Lemberg ca87cd0bda Fix `make multi'.
* src/cache/ftccache.c, src/cache/ftcsbits.c (FT_COMPONENT): Define.

* src/sfnt/sfdriver.c: Include FT_INTERNAL_DEBUG_H.
2009-10-06 11:09:29 +02:00
suzuki toshiya ed1d359025 cache: Fix some data types mismatching with their sources. 2009-08-01 00:32:10 +09:00
suzuki toshiya ebf8e294fc cache: Fix some data types mismatching with their sources. 2009-08-01 00:30:19 +09:00
Werner Lemberg 858abbedc0 For warning messages, replace FT_ERROR with FT_TRACE0.
FT_ERROR is now used only if a function produces a non-zero `error'
value.

Formatting, improving and harmonizing debug strings.
2009-06-26 06:15:41 +02:00
Werner Lemberg 6c5b617c59 * src/cache/ftccache.c, (ftc_node_mru_up, FTC_Cache_Lookup)
[!FTC_INLINE]: Compile conditionally.
* src/cache/ftccache.h: Updated.

* src/cache/ftcglyph.c (FTC_GNode_Init, FTC_GNode_UnselectFamily,
FTC_GNode_Done, FTC_GNode_Compare, FTC_Family_Init, FTC_GCache_New):
s/FT_EXPORT/FT_LOCAL/.
(FTC_GCache_Init, FTC_GCache_Done): Commented out.
(FTC_GCache_Lookup) [!FTC_INLINE]: Compile conditionally.
s/FT_EXPORT/FT_LOCAL/.
* src/cache/ftcglyph.h: Updated.

* src/cache/ftcimage.c (FTC_INode_Free, FTC_INode_New):
s/FT_EXPORT/FT_LOCAL/.
(FTC_INode_Weight): Commented out.
* src/cache/ftcimage.h: Updated.

* src/cache/ftmanag.c (FTC_Manager_Compress,
FTC_Manager_RegisterCache, FTC_Manager_FlushN):
s/FT_EXPORT/FT_LOCAL/.
* src/cache/ftmanag.h: Updated.

* src/cache/ftcsbits.c (FTC_SNode_Free, FTC_SNode_New,
FTC_SNode_Compare): s/FT_EXPORT/FT_LOCAL/.
(FTC_SNode_Weight): Commented out.
* src/cache/ftcsbits.h: Updated.
2006-03-22 15:30:41 +00:00
Werner Lemberg 5a73d8d20f * builds/freetype.mk (CACHE_DIR, CACHE_H): Remove.
(FREETYPE_H): Updated.

* src/cache/rules.mk (CACHE_H_DIR): Remove.
(CACHE_DRV_H): Updated.

Formatting, copyright years.
2006-03-20 16:55:32 +00:00
David Turner 256de4b18f * include/freetype/cache/ftccache.h,
include/freetype/cache/ftccmap.h,
    include/freetype/cache/ftcglyph.h
    include/freetype/cache/ftcimage.h
    include/freetype/cache/ftcmanag.h
    include/freetype/cache/ftcmru.h
    include/freetype/cache/ftcsbits.h:
      removing these header files from the public include directory.

    * include/freetype/config/ftheader.h:
      changing the definition of FT_CACHE_INTERNAL_XXX_H macros to
      redirect to FT_CACHE_H instead

    * src/cache/ftcbasic.c, src/cache/ftccache.c, src/cache/ftccache.h,
    src/cache/ftccback.h, src/cache/ftccmap.c, src/cache/ftcglyph.c,
    src/cache/ftcglyph.h, src/cache/ftcimage.c, src/cache/ftcimage.h,
    src/cache/ftcmanag.c, src/cache/ftcmanag.h, src/cache/ftcmru.c,
    src/cache/ftcmru.h, src/cache/ftcsbits.c, src/cache/ftcsbits.h:
      modifications to prevent using the FT_CACHE_INTERNAL_XXX_H macros,
      and grab the headers in 'src/cache' instead (see below).
2006-03-20 12:10:24 +00:00
Werner Lemberg 92aa527a1c * builds/amiga/makefile.os4 (WARNINGS), builds/compiler/gcc-dev.mk
(CFLAGS), builds/compiler/gcc.mk (CFLAGS): Remove
-fno-strict-aliasing.


Say you have `(Foo*)x' and want to assign, pass, or return it as
`(Bar*)'.  If you simply say `x' or `(Bar*)x', then the C compiler
would warn you that type casting incompatible pointer types breaks
strict-aliasing.  The solution is to cast to `(void*)' instead which
is the generic pointer type, so the compiler knows that it should
make no strict-aliasing assumption on `x'.  But the problem with
`(void*)x' is that seems like in C++, unlike C, `void*' is not a
generic pointer type and assigning `void*' to `Bar*' without a cast
causes an error.  The solution is to cast to `Bar*' too, with
`(Bar*)(void*)x' as the result -- this is what the patch does.

* include/freetype/cache/ftccache.h (FTC_CACHE_LOOKUP_CMP),
include/freetype/cache/ftcmru.h (FTC_MRULIST_LOOKUP_CMP): Remove
cast on lvalue, use a temporary pointer instead.
Cast temporarily to (void*) to not break strict aliasing.

* include/freetype/internal/ftmemory.h (FT_MEM_ALLOC,
FT_MEM_REALLOC, FT_MEM_QALLOC, FT_MEM_QREALLOC, FT_MEM_FREE),
src/base/ftglyph.c (FT_Glyph_To_Bitmap): Cast temporarily to (void*)
to not break strict aliasing.

* src/base/ftinit.c (FT_USE_MODULE): Fix wrong type information.

* builds/unix/configure.ac (XX_CFLAGS): Remove -fno-strict-aliasing.

* src/sfnt/rules.mk (SFNT_DRV_SRC): Don't include ttsbit0.c --
it is currently loaded from ttsbit.c.


Other formatting.
2005-05-23 21:33:02 +00:00
David Turner f9e0559778 * include/freetype/cache/ftcache.h, src/cache/ftccache.c,
src/cache/ftcsbits.c: fixing bug #12213 (incorrect behaviour
    of the cache sub-system in low-memory conditions).
2005-05-23 13:04:53 +00:00
David Turner 6a6e6f27ac * src/cache/ftcsbits.c: fixing advance computation for
transformed glyphs
2004-07-12 22:54:09 +00:00
Werner Lemberg fefd874292 * docs/CHANGES: Updated.
Minor clean-ups.
2004-06-12 13:21:20 +00:00
David Turner b83239b7fd * include/freetype/cache/ftcmru.h, src/cache/ftcbasic.c,
src/cache/ftccache.c, src/cache/ftcglyph.c, src/cache/ftcmanag.c,
        src/cache/ftcsbits.c:
        fixing some annoying bugs and inefficiencies in the cache sub-system.
2004-06-09 21:07:49 +00:00
Werner Lemberg e260d2538d * src/cache/ftcbasic.c (ftc_basic_family_compare,
ftc_basic_family_init, ftc_basic_family_get_count,
ftc_basic_family_load_bitmap, ftc_basic_family_load_glyph,
ftc_basic_gnode_compare_faceid): Adjust parameters and return types
to prototypes given in header files from include/freetype/cache.
Use casts to proper types locally.
(ftc_basic_image_family_class, ftc_basic_image_cache_class,
ftc_basic_sbit_family_class, ftc_basic_sbit_cache_class): Remove
casts.

* src/cache/ftccback.h: Adjust parameters and return types to
prototypes given in header files from include/freetype/cache.

* src/cache/ftcimage.c (ftc_inode_free, ftc_inode_new,
ftc_inode_weight): Adjust parameters and return types to prototypes
given in header files from include/freetype/cache.  Use casts to
proper types locally.

* src/cache/ftcsbits.c (ftc_snode_free, ftc_snode_new,
ftc_snode_weight, ftc_snode_compare): Adjust parameters and return
types to prototypes given in header files from
include/freetype/cache.  Use casts to proper types locally.

* src/cache/ftccmap.c (ftc_cmap_node_free, ftc_cmap_node_new,
ftc_cmap_node_weight, ftc_cmap_node_compare,
ftc_cmap_node_remove_faceid): Adjust parameters and return types to
prototypes given in header files from include/freetype/cache.  Use
casts to proper types locally.
(ftc_cmap_cache_class): Remove casts.

* src/cache/ftcglyph.c (ftc_gnode_compare, ftc_gcache_init,
ftc_gcache_done): Adjust parameters and return types to prototypes
given in header files from include/freetype/cache.  Use casts to
proper types locally.

* src/cache/ftcmanag.c (ftc_size_node_done, ftc_size_node_compare,
ftc_size_node_init, ftc_size_node_reset,
ftc_size_node_compare_faceid, ftc_face_node_init,
ftc_face_node_done, ftc_face_node_compare: Adjust parameters and
return types to prototypes given in header files from
include/freetype/cache.  Use casts to proper types locally.

(ftc_size_list_class, ftc_face_list_class): Remove casts.


* src/autohint/ahmodule.c (ft_autohinter_init, ft_autohinter_done):
Use FT_Module as parameter and do a cast to FT_AutoHinter locally.
(autohint_module_class): Remove casts.

* src/base/ftglyph.c (ft_bitmap_glyph_init, ft_bitmap_glyph_copy,
ft_bitmap_glyph_done, ft_bitmap_glyph_bbox, ft_outline_glyph_init,
ft_outline_glyph_done, ft_outline_glyph_copy,
ft_outline_glyph_transform, ft_outline_glyph_bbox,
ft_outline_glyph_prepare): Use FT_Glyph as parameter and do a cast
to FT_XXXGlyph locally.
Use FT_CALLBACK_DEF throughout.
(ft_bitmap_glyph_class, ft_outline_glyph_class): Remove casts.

* src/bdf/bdfdrivr.c (bdf_cmap_init, bdf_cmap_done,
bdf_cmap_char_index, bdf_cmap_char_next): Use FT_CMap as parameter
and do a cast to BDF_CMap locally.
(bdf_cmap_class): Remove casts.
2004-05-17 09:25:04 +00:00
Werner Lemberg 336bc908c8 * src/cache/ftcsbits.c (ftc_snode_load): Initialize `*asize' in case
of error.
2004-04-15 16:09:31 +00:00