* include/freetype/config/ftmodule.h: Add both the 'sfd' and 'bsfd'
renderers to the list of modules.
* CMakeLists.txt (BASE_SRCS): Add 'sdf' single-object module.
* src/sdf/module.mk, src/sfd/rules.mk: New files.
* src/sdf/ftsdf.h (ft_sdf_raster): New forward declaration.
* include/freetype/ftmoderr.h (FT_MODERRDEF): Add error definition
for the 'sdf' module.
* include/freetype/internal/fttrace.h (FT_TRACE_DEF): Add trace
definition for the `sdf' module.
* modules.cfg (RASTER_MODULES): Add the `sdf' module to the list of
rasterizers.
* src/sdf/ftsdf.c (sdf_generate_bounding_box): New function, which
is an optimized version of `sdf_generate`.
(sdf_generate_subdivision): New function.
* src/sdf/ftsdf.c (sdf_generate): New function, currently disabled.
This is a proof-of-concept implementation: It doesn't use any
optimization, it simply checks all grid points against all contours.
* src/sdf/ftsdf.c (get_min_distance_line, get_min_distance_conic,
get_min_distance_cubic): New functions. Note that
`get_min_distance_conic` comes with two implementations (using an
analytical and an iterative method, to be controlled with the
`USE_NEWTON_FOR_CONIC` macro).
* src/sdf/ftsdf.c (FT_DEBUG_INNER, FT_ASSIGNP_INNER)
[FT_DEBUG_LEVEL_TRACE && FT_DEBUG_MEMORY]: New macros.
(SDF_MemoryUser) [FT_DEBUG_LEVEL_TRACE && FT_DEBUG_MEMORY]: New
struct for memory usage tracing.
(sdf_alloc, sdf_free) [FT_DEBUG_LEVEL_TRACE && FT_DEBUG_MEMORY]: New
functions for memory usage tracing.
(SDF_ALLOC, SDF_FREE): New macros for memory management.
(SDF_MEMORY_TRACKER_DECLARE, SDF_MEMORY_TRACKER_SETUP,
SDF_MEMORY_TRACKER_DONE): New macros to set up memory usage tracing.
(USE_NEWTON_FOR_CONIC, MAX_NEWTON_DIVISIONS, MAX_NEWTON_STEPS,
CORNER_CHECK_EPSILON, CG_DIMEN): New configuration macros for
controlling the process of finding the shortest distance.
(MUL_26D6, VEC_26D6_DOT): New auxiliary macros.
(SDF_TRaster, SDF_Edge, SDF_Contour, SDF_Shape, SDF_Signed_Distance,
SDF_Params): New structs for setting up SDF data.
(SDF_Edge_Type, SDF_Contour_Orientation): New enums for SDF data.
(zero_vector, null_edge, null_contour, null_shape, max_sdf): Useful
constants.
(sdf_edge_new, sdf_edge_done, sdf_contour_new, sdf_contour_done,
sdf_shape_new, sdf_shape_done): New constructors and destructors.
Here is a breakdown of what the files will contain.
* src/sdf/ftsdfrend.c, src/sdf/ftsdfrend.h: The 'sdf' and 'bsdf'
renderers.
* src/sdf/ftsdf.c, src/sdf/ftsdf.h: The rasterizer for the 'sdf'
renderer.
* src/sdf/ftbsdf.c, src/sdf/ftbsdf.h: The rasterizer for the 'bsdf'
renderer.
* src/sdf/ftsdfcommon.h: Commmon properties and functions for both
rasterizers.
* src/sdf/ftsdferrs.h: Common error defines.
* src/sdf/sdf.c: For building a single object of the entire module.
* src/base/ftobjs.c (FT_Render_Glyph_Internal): Do not return if the
glyph's slot format is `FT_GLYPH_FORMAT_BITMAP`. The forthcoming
'bsdf' renderer will require bitmaps for processing.
* src/base/ftobjs.c (ft_add_renderer, ft_remove_renderer): Remove
renderer's glyph format check before adding and removing them. The
'bsdf' renderer will have a format `FT_GLYPH_FORMAT_BITMAP`.
* include/freetype/freetype.h (FT_Render_Mode): Add new render mode
`FT_RENDER_MODE_SDF`, which will be used to generate SDF.
* include/freetype/ftimage.h (FT_Pixel_Mode): Add new pixel mode
`FT_PIXEL_MODE_GRAY16`, which will be the output of the 'sdf'
module.
(FT_RASTER_FLAG_SDF): New raster flag to be used internally by the
'sdf' module.
* include/freetype/fttypes.h (FT_F6Dot10): New data type.
* src/base/ftobjs.c (FT_Render_Glyph_Internal): Do not return if the
glyph's slot format is `FT_GLYPH_FORMAT_BITMAP`. The forthcoming
'bsdf' renderer will require bitmaps for processing.
* src/base/ftobjs.c (ft_add_renderer, ft_remove_renderer): Remove
renderer's glyph format check before adding and removing them. The
'bsdf' renderer will have a format `FT_GLYPH_FORMAT_BITMAP`.