[sdfb] Added new module to generate SDF from bitmap.
* src/sdfb/sdfb.c, src/sdfb/ftsdfbrend.c, src/sdfb/ftsdfb.c, src/sdfb/ftsdfbrend.h, src/sdfb/ftsdfb.h, src/sdfb/ftsdfberrs.h: Added files required by the `sdfb' renderer module. * src/sdfb/rules.mk, src/sdfb/module.mk: Added files required to build the `sdfb' module using the default build system. * CMakeLists.txt (BASE_SRCS): Add `src/sdfb/sdfb.c' to the variable. * include/freetype/config/ftmodule.h: Added `sdfb' module declaration so that the module can be compiled when not compiling with GNU make. * modules.cfg (RASTER_MODULES): Include `sdfb' module to the default rasterizer module list. * include/freetype/ftmoderr.h: sdfb module error define * src/sdf/rules.mk: Add EOF.
This commit is contained in:
parent
968a2f6237
commit
04f2a34a7d
|
@ -348,6 +348,7 @@ set(BASE_SRCS
|
||||||
src/psnames/psnames.c
|
src/psnames/psnames.c
|
||||||
src/raster/raster.c
|
src/raster/raster.c
|
||||||
src/sdf/sdf.c
|
src/sdf/sdf.c
|
||||||
|
src/sdfb/sdfb.c
|
||||||
src/sfnt/sfnt.c
|
src/sfnt/sfnt.c
|
||||||
src/smooth/smooth.c
|
src/smooth/smooth.c
|
||||||
src/truetype/truetype.c
|
src/truetype/truetype.c
|
||||||
|
|
|
@ -1,3 +1,30 @@
|
||||||
|
2020-07-17 Anuj Verma <anujv@iitbhilai.ac.in>
|
||||||
|
|
||||||
|
[sdfb] Added new module to generate SDF from bitmap.
|
||||||
|
|
||||||
|
* src/sdfb/sdfb.c, src/sdfb/ftsdfbrend.c,
|
||||||
|
src/sdfb/ftsdfb.c, src/sdfb/ftsdfbrend.h,
|
||||||
|
src/sdfb/ftsdfb.h, src/sdfb/ftsdfberrs.h:
|
||||||
|
Added files required by the `sdfb' renderer module.
|
||||||
|
|
||||||
|
* src/sdfb/rules.mk, src/sdfb/module.mk: Added
|
||||||
|
files required to build the `sdfb' module using
|
||||||
|
the default build system.
|
||||||
|
|
||||||
|
* CMakeLists.txt (BASE_SRCS): Add `src/sdfb/sdfb.c'
|
||||||
|
to the variable.
|
||||||
|
|
||||||
|
* include/freetype/config/ftmodule.h: Added `sdfb'
|
||||||
|
module declaration so that the module can be compiled
|
||||||
|
when not compiling with GNU make.
|
||||||
|
|
||||||
|
* modules.cfg (RASTER_MODULES): Include `sdfb' module
|
||||||
|
to the default rasterizer module list.
|
||||||
|
|
||||||
|
* include/freetype/ftmoderr.h: sdfb module error define
|
||||||
|
|
||||||
|
* src/sdf/rules.mk: Add EOF.
|
||||||
|
|
||||||
2020-07-17 Anuj Verma <anujv@iitbhilai.ac.in>
|
2020-07-17 Anuj Verma <anujv@iitbhilai.ac.in>
|
||||||
|
|
||||||
[sdf] Added memory tracker.
|
[sdf] Added memory tracker.
|
||||||
|
|
|
@ -27,5 +27,6 @@ FT_USE_MODULE( FT_Module_Class, sfnt_module_class )
|
||||||
FT_USE_MODULE( FT_Renderer_Class, ft_smooth_renderer_class )
|
FT_USE_MODULE( FT_Renderer_Class, ft_smooth_renderer_class )
|
||||||
FT_USE_MODULE( FT_Driver_ClassRec, bdf_driver_class )
|
FT_USE_MODULE( FT_Driver_ClassRec, bdf_driver_class )
|
||||||
FT_USE_MODULE( FT_Renderer_Class, ft_sdf_renderer_class )
|
FT_USE_MODULE( FT_Renderer_Class, ft_sdf_renderer_class )
|
||||||
|
FT_USE_MODULE( FT_Renderer_Class, ft_sdfb_renderer_class )
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
|
@ -172,6 +172,7 @@
|
||||||
FT_MODERRDEF( Winfonts, 0x1500, "Windows FON/FNT module" )
|
FT_MODERRDEF( Winfonts, 0x1500, "Windows FON/FNT module" )
|
||||||
FT_MODERRDEF( GXvalid, 0x1600, "GX validation module" )
|
FT_MODERRDEF( GXvalid, 0x1600, "GX validation module" )
|
||||||
FT_MODERRDEF( Sdf, 0x1700, "signed distance field raster module" )
|
FT_MODERRDEF( Sdf, 0x1700, "signed distance field raster module" )
|
||||||
|
FT_MODERRDEF( Sdfb, 0x1700, "signed distance field converter module" )
|
||||||
|
|
||||||
|
|
||||||
#ifdef FT_MODERR_END_LIST
|
#ifdef FT_MODERR_END_LIST
|
||||||
|
|
12
modules.cfg
12
modules.cfg
|
@ -102,6 +102,18 @@ RASTER_MODULES += smooth
|
||||||
# Signed distance field rasterizer.
|
# Signed distance field rasterizer.
|
||||||
RASTER_MODULES += sdf
|
RASTER_MODULES += sdf
|
||||||
|
|
||||||
|
####
|
||||||
|
#### post processing modules -- for doing post processing on bitmaps
|
||||||
|
####
|
||||||
|
|
||||||
|
# Currently there is no seperate list for post processing modules
|
||||||
|
# so we simply use the `RASTER_MODULES' list.
|
||||||
|
|
||||||
|
# Signed distance field generator. This one uses bitmaps
|
||||||
|
# to generate SDF unlike the `sdf' module which require
|
||||||
|
# outlines.
|
||||||
|
RASTER_MODULES += sdfb
|
||||||
|
|
||||||
####
|
####
|
||||||
#### auxiliary modules
|
#### auxiliary modules
|
||||||
####
|
####
|
||||||
|
|
|
@ -56,3 +56,5 @@ $(OBJ_DIR)/%.$O: $(SDF_DIR)/%.c $(FREETYPE_H) $(SDF_DRV_H)
|
||||||
#
|
#
|
||||||
DRV_OBJS_S += $(SDF_DRV_OBJ_S)
|
DRV_OBJS_S += $(SDF_DRV_OBJ_S)
|
||||||
DRV_OBJS_M += $(SDF_DRV_OBJ_M)
|
DRV_OBJS_M += $(SDF_DRV_OBJ_M)
|
||||||
|
|
||||||
|
# EOF
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
|
||||||
|
/* END */
|
|
@ -0,0 +1,2 @@
|
||||||
|
|
||||||
|
/* END */
|
|
@ -0,0 +1,18 @@
|
||||||
|
|
||||||
|
#ifndef FTSDFBERRS_H_
|
||||||
|
#define FTSDFBERRS_H_
|
||||||
|
|
||||||
|
#include <freetype/ftmoderr.h>
|
||||||
|
|
||||||
|
#undef FTERRORS_H_
|
||||||
|
|
||||||
|
#undef FT_ERR_PREFIX
|
||||||
|
#define FT_ERR_PREFIX Sdfb_Err_
|
||||||
|
#define FT_ERR_BASE FT_Mod_Err_Sdfb
|
||||||
|
|
||||||
|
#include <freetype/fterrors.h>
|
||||||
|
|
||||||
|
#endif /* FTSDFBERRS_H_ */
|
||||||
|
|
||||||
|
|
||||||
|
/* END */
|
|
@ -0,0 +1,43 @@
|
||||||
|
|
||||||
|
#include "ftsdfbrend.h"
|
||||||
|
|
||||||
|
#include "ftsdfberrs.h"
|
||||||
|
|
||||||
|
/**************************************************************************
|
||||||
|
*
|
||||||
|
* The macro FT_COMPONENT is used in trace mode. It is an implicit
|
||||||
|
* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log
|
||||||
|
* messages during execution.
|
||||||
|
*/
|
||||||
|
#undef FT_COMPONENT
|
||||||
|
#define FT_COMPONENT sdfb
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
FT_DEFINE_RENDERER(
|
||||||
|
ft_sdfb_renderer_class,
|
||||||
|
|
||||||
|
FT_MODULE_RENDERER,
|
||||||
|
sizeof( SDFB_Renderer_Module ),
|
||||||
|
|
||||||
|
"sdfb",
|
||||||
|
0x10000L,
|
||||||
|
0x20000L,
|
||||||
|
|
||||||
|
NULL,
|
||||||
|
|
||||||
|
(FT_Module_Constructor) NULL,
|
||||||
|
(FT_Module_Destructor) NULL,
|
||||||
|
(FT_Module_Requester) NULL,
|
||||||
|
|
||||||
|
FT_GLYPH_FORMAT_BITMAP,
|
||||||
|
|
||||||
|
(FT_Renderer_RenderFunc) NULL, /* render_glyph */
|
||||||
|
(FT_Renderer_TransformFunc) NULL, /* transform_glyph */
|
||||||
|
(FT_Renderer_GetCBoxFunc) NULL, /* get_glyph_cbox */
|
||||||
|
(FT_Renderer_SetModeFunc) NULL, /* set_mode */
|
||||||
|
|
||||||
|
(FT_Raster_Funcs*) NULL /* raster_class */
|
||||||
|
)
|
||||||
|
|
||||||
|
/* END */
|
|
@ -0,0 +1,43 @@
|
||||||
|
|
||||||
|
#ifndef FTSDFBREND_H_
|
||||||
|
#define FTSDFBREND_H_
|
||||||
|
|
||||||
|
|
||||||
|
#include <freetype/ftrender.h>
|
||||||
|
#include <freetype/ftmodapi.h>
|
||||||
|
#include <freetype/internal/ftobjs.h>
|
||||||
|
|
||||||
|
|
||||||
|
FT_BEGIN_HEADER
|
||||||
|
|
||||||
|
/**************************************************************************
|
||||||
|
*
|
||||||
|
* @struct:
|
||||||
|
* SDFB_Renderer_Module
|
||||||
|
*
|
||||||
|
* @description:
|
||||||
|
* [TODO]
|
||||||
|
*
|
||||||
|
* @fields:
|
||||||
|
* [TODO]
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
typedef struct SDFB_Renderer_Module_
|
||||||
|
{
|
||||||
|
FT_RendererRec root;
|
||||||
|
FT_UInt spread;
|
||||||
|
FT_Bool flip_sign;
|
||||||
|
FT_Bool flip_y;
|
||||||
|
|
||||||
|
} SDFB_Renderer_Module, *SDFB_Renderer;
|
||||||
|
|
||||||
|
|
||||||
|
FT_DECLARE_RENDERER( ft_sdfb_renderer_class )
|
||||||
|
|
||||||
|
|
||||||
|
FT_END_HEADER
|
||||||
|
|
||||||
|
#endif /* FTSDFBREND_H_ */
|
||||||
|
|
||||||
|
|
||||||
|
/* END */
|
|
@ -0,0 +1,10 @@
|
||||||
|
|
||||||
|
|
||||||
|
FTMODULE_H_COMMANDS += SDFB_RENDERER
|
||||||
|
|
||||||
|
define SDFB_RENDERER
|
||||||
|
$(OPEN_DRIVER) FT_Renderer_Class, ft_sdfb_renderer_class $(CLOSE_DRIVER)
|
||||||
|
$(ECHO_DRIVER)sdfb $(ECHO_DRIVER_DESC)signed distance field converter$(ECHO_DRIVER_DONE)
|
||||||
|
endef
|
||||||
|
|
||||||
|
#EOF
|
|
@ -0,0 +1,60 @@
|
||||||
|
|
||||||
|
|
||||||
|
# sdf bitmap driver directory
|
||||||
|
#
|
||||||
|
SDFB_DIR := $(SRC_DIR)/sdfb
|
||||||
|
|
||||||
|
|
||||||
|
# compilation flags for the driver
|
||||||
|
#
|
||||||
|
SDFB_COMPILE := $(CC) $(ANSIFLAGS) \
|
||||||
|
$I$(subst /,$(COMPILER_SEP),$(SDFB_DIR)) \
|
||||||
|
$(INCLUDE_FLAGS) \
|
||||||
|
$(FT_CFLAGS)
|
||||||
|
|
||||||
|
|
||||||
|
# sdf bitmap driver sources (i.e., C files)
|
||||||
|
#
|
||||||
|
SDFB_DRV_SRC := $(SDFB_DIR)/ftsdfbrend.c \
|
||||||
|
$(SDFB_DIR)/ftsdfb.c
|
||||||
|
|
||||||
|
|
||||||
|
# sdf bitmap driver headers
|
||||||
|
#
|
||||||
|
SDFB_DRV_H := $(SDFB_DRV_SRC:%.c=%.h) \
|
||||||
|
$(SDFB_DIR)/ftsdferrs.h
|
||||||
|
|
||||||
|
|
||||||
|
# sdf bitmap driver object(s)
|
||||||
|
#
|
||||||
|
# SDFB_DRV_OBJ_M is used during `multi' builds.
|
||||||
|
# SDFB_DRV_OBJ_S is used during `single' builds.
|
||||||
|
#
|
||||||
|
SDFB_DRV_OBJ_M := $(SDFB_DRV_SRC:$(SDFB_DIR)/%.c=$(OBJ_DIR)/%.$O)
|
||||||
|
SDFB_DRV_OBJ_S := $(OBJ_DIR)/sdfb.$O
|
||||||
|
|
||||||
|
|
||||||
|
# sdf driver source file for single build
|
||||||
|
#
|
||||||
|
SDFB_DRV_SRC_S := $(SDFB_DIR)/sdfb.c
|
||||||
|
|
||||||
|
|
||||||
|
# sdf bitmap driver - single object
|
||||||
|
#
|
||||||
|
$(SDFB_DRV_OBJ_S): $(SDFB_DRV_SRC_S) $(SDFB_DRV_SRC) \
|
||||||
|
$(FREETYPE_H) $(SDFB_DRV_H)
|
||||||
|
$(SDFB_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $(SDFB_DRV_SRC_S))
|
||||||
|
|
||||||
|
|
||||||
|
# sdf bitmap driver - multiple objects
|
||||||
|
#
|
||||||
|
$(OBJ_DIR)/%.$O: $(SDFB_DIR)/%.c $(FREETYPE_H) $(SDFB_DRV_H)
|
||||||
|
$(SDFB_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<)
|
||||||
|
|
||||||
|
|
||||||
|
# update main driver list
|
||||||
|
#
|
||||||
|
DRV_OBJS_S += $(SDFB_DRV_OBJ_S)
|
||||||
|
DRV_OBJS_M += $(SDFB_DRV_OBJ_M)
|
||||||
|
|
||||||
|
# EOF
|
|
@ -0,0 +1,9 @@
|
||||||
|
|
||||||
|
|
||||||
|
#define FT_MAKE_OPTION_SINGLE_OBJECT
|
||||||
|
|
||||||
|
#include "ftsdfbrend.c"
|
||||||
|
#include "ftsdfb.c"
|
||||||
|
|
||||||
|
|
||||||
|
/* END */
|
Loading…
Reference in New Issue