Implemented a basic integration of dlg with FreeType

This commit is contained in:
Priyeshkkumar 2020-06-29 17:49:57 +05:30
parent a443474755
commit 01ce8ff340
6 changed files with 69 additions and 4 deletions

3
.gitmodules vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "src/dlg"]
path = src/dlg
url = https://github.com/nyorain/dlg.git

15
[priyesh]ChangeLog Normal file
View File

@ -0,0 +1,15 @@
2020-06-29 Priyesh Kumar <priyeshkkumar@gmail.com>
* Added submodule - dlg library (https://github.com/nyorain/dlg)
in src/dlg.
This library is used as a logger for FreeType.
* include/freetype/config/ftoption.h: Added macro `FT_LOGGING`
to enable/disable logging in FreeType using dlg.
* [builds] unix-cc-in: Added -std=c99, since dlg does not support
C standards below c99.
* include/freetype/internal/ftdebug.h: Created an environment for dlg
support in FreeType.

View File

@ -79,7 +79,7 @@ T := -o$(space)
# We use our own FreeType configuration files overriding defaults.
#
CPPFLAGS := @CPPFLAGS@
CFLAGS := -c @XX_CFLAGS@ @CFLAGS@ \
CFLAGS := -c -std=c99 @XX_CFLAGS@ @CFLAGS@ \
$DFT_CONFIG_CONFIG_H="<ftconfig.h>" \
$DFT_CONFIG_MODULES_H="<ftmodule.h>" \
$DFT_CONFIG_OPTIONS_H="<ftoption.h>"

View File

@ -431,6 +431,20 @@ FT_BEGIN_HEADER
/* #define FT_DEBUG_LEVEL_TRACE */
/*************************************************************************
*
* Logging
*
* Compiling FreeType in debug or trace mode will make FreeType to write
* error and trace log messages to `stderr`.
* Enabling this macro will automatically force the `FT_DEBUG_LEVEL_ERROR`
* and `FT_DEBUG_LEVEL_TRACE` macros and will allow FreeType to write
* error and trace log messages to a file instead of `stderr`
*
*/
/* #define FT_LOGGING */
/**************************************************************************
*
* Autofitter debugging

View File

@ -29,10 +29,25 @@
#include FT_CONFIG_CONFIG_H
#include <freetype/freetype.h>
/* Additional include files for supporting logging in FreeType using */
/* external logging library ~ src/dlg */
/* */
#include <../src/dlg/include/dlg/dlg.h>
#include <../src/dlg/include/dlg/output.h>
FT_BEGIN_HEADER
/* force the definition of FT_DEBUG_LEVEL_TRACE if FT_LOGGING is already*/
/* defined; therefore the following macros */
/* */
#ifdef FT_LOGGING
#undef FT_DEBUG_LEVEL_TRACE
#define FT_DEBUG_LEVEL_TRACE
#endif /* FT_LOGGING */
/* force the definition of FT_DEBUG_LEVEL_ERROR if FT_DEBUG_LEVEL_TRACE */
/* is already defined; this simplifies the following #ifdefs */
/* */
@ -74,14 +89,31 @@ FT_BEGIN_HEADER
/**************************************************************************
*
* Define the FT_TRACE macro
*
*
* IMPORTANT!
*
* Each component must define the macro FT_COMPONENT to a valid FT_Trace
* value before using any TRACE macro.
*
*
* If FT_LOGGING is enabled, trace messages will be sent to
* dlg's APIs and is FT_LOGGING is disabled trace messages will be sent to
* FT_Message(defined in ftdebug.c)
* Therefore the following macros:
*
*/
#ifdef FT_LOGGING
#undef FT_Log
#define FT_Log dlg_trace
#else
#undef FT_Log
#define FT_Log FT_Message
#endif /* FT_LOGGING */
#ifdef FT_DEBUG_LEVEL_TRACE
/* we need two macros here to make cpp expand `FT_COMPONENT' */
@ -92,7 +124,7 @@ FT_BEGIN_HEADER
do \
{ \
if ( ft_trace_levels[FT_TRACE_COMP( FT_COMPONENT )] >= level ) \
FT_Message varformat; \
FT_Log varformat; \
} while ( 0 )
#else /* !FT_DEBUG_LEVEL_TRACE */

1
src/dlg Submodule

@ -0,0 +1 @@
Subproject commit 407e385d2e40e11a1f1643cdf698fd09d62561ca