2003-04-21 15:30:27 +02:00
|
|
|
|
Debugging within the FreeType sources
|
|
|
|
|
=====================================
|
2002-07-09 01:02:32 +02:00
|
|
|
|
|
2002-07-26 11:09:10 +02:00
|
|
|
|
I. Configuration macros
|
|
|
|
|
-----------------------
|
2002-07-09 01:02:32 +02:00
|
|
|
|
|
2013-11-13 08:55:46 +01:00
|
|
|
|
There are several ways to enable debugging features in a FreeType 2
|
|
|
|
|
builds. This is controlled through the definition of special macros
|
2017-01-23 05:09:05 +01:00
|
|
|
|
located in the file `ftoption.h'. The macros are:
|
2002-07-09 01:02:32 +02:00
|
|
|
|
|
|
|
|
|
|
2002-07-26 11:09:10 +02:00
|
|
|
|
FT_DEBUG_LEVEL_ERROR
|
2002-07-09 01:02:32 +02:00
|
|
|
|
|
2019-10-06 20:07:09 +02:00
|
|
|
|
#define this macro if you want to compile the `FT_ERROR' macro
|
|
|
|
|
calls to print error messages during program execution. This does
|
|
|
|
|
not stop the program. Very useful to spot invalid fonts during
|
2003-04-21 15:30:27 +02:00
|
|
|
|
development and to code workarounds for them.
|
2002-07-09 01:02:32 +02:00
|
|
|
|
|
2002-07-26 11:09:10 +02:00
|
|
|
|
FT_DEBUG_LEVEL_TRACE
|
2002-07-09 01:02:32 +02:00
|
|
|
|
|
2019-10-06 20:07:09 +02:00
|
|
|
|
#define this macro if you want to compile both macros `FT_ERROR'
|
|
|
|
|
and `FT_TRACE'. This also includes the variants `FT_TRACE0',
|
|
|
|
|
`FT_TRACE1', `FT_TRACE2', ..., `FT_TRACE7'.
|
2002-07-09 01:02:32 +02:00
|
|
|
|
|
2013-11-13 08:55:46 +01:00
|
|
|
|
The trace macros are used to send debugging messages when an
|
|
|
|
|
appropriate `debug level' is configured at runtime through the
|
2019-10-06 20:07:09 +02:00
|
|
|
|
`FT2_DEBUG' environment variable (more on this later).
|
2002-07-09 01:02:32 +02:00
|
|
|
|
|
2002-07-26 11:09:10 +02:00
|
|
|
|
FT_DEBUG_MEMORY
|
2002-07-09 01:02:32 +02:00
|
|
|
|
|
2013-11-13 08:55:46 +01:00
|
|
|
|
If this macro is #defined, the FreeType engine is linked with a
|
|
|
|
|
small but effective debugging memory manager that tracks all
|
2002-07-26 11:09:10 +02:00
|
|
|
|
allocations and frees that are performed within the font engine.
|
2002-07-09 01:02:32 +02:00
|
|
|
|
|
2019-10-06 20:07:09 +02:00
|
|
|
|
When the `FT2_DEBUG_MEMORY' environment variable is defined at
|
|
|
|
|
runtime, a call to `FT_Done_FreeType' dumps memory statistics,
|
|
|
|
|
including the list of leaked memory blocks and optionally with the
|
|
|
|
|
source locations where these were allocated. It is always a very
|
|
|
|
|
good idea to define this in development builds. This works with
|
|
|
|
|
_any_ program linked to FreeType, but requires a big deal of
|
|
|
|
|
memory (the debugging memory manager never frees the blocks to the
|
|
|
|
|
heap in order to detect double frees).
|
2002-07-09 01:02:32 +02:00
|
|
|
|
|
2019-10-06 20:07:09 +02:00
|
|
|
|
When `FT2_DEBUG_MEMORY' isn't defined at runtime, the debugging
|
2013-11-13 08:55:46 +01:00
|
|
|
|
memory manager is ignored, and performance is unaffected.
|
2002-07-09 01:02:32 +02:00
|
|
|
|
|
2020-08-28 07:58:17 +02:00
|
|
|
|
FT_LOGGING
|
|
|
|
|
|
|
|
|
|
As mentioned above if `FT_DEBUG_LEVEL_ERROR' and
|
|
|
|
|
`FT_DEBUG_LEVEL_TRACE' macros are defined, FreeType will send the
|
|
|
|
|
debug and trace logs outputted from `FT_ERROR' and `FT_TRACE'
|
|
|
|
|
macros to `stderr'.
|
|
|
|
|
|
|
|
|
|
`FT_LOGGING' is a new macro which is introduced to enhance the
|
|
|
|
|
capabilities of `FT_TRACE' and `FT_ERROR' macros.
|
|
|
|
|
`FT_LOGGING' macro depends on `FT_DEBUG_LEVEL_TRACE' and
|
|
|
|
|
`FT_DEBUG_LEVEL_ERROR', therefore these macros will automatically
|
|
|
|
|
be #defined once `FT_LOGGING' macro is #defined and
|
|
|
|
|
the behaviour of `FT_TRACE' and `FT_ERROR' macros will change.
|
|
|
|
|
Now, `FT_TRACE' and `FT_ERROR' macros will start sending the
|
|
|
|
|
tracing and debugging messages to the file system instead of
|
|
|
|
|
`stderr'.
|
|
|
|
|
On the file system the log file will be generated on the path
|
|
|
|
|
specified using `FT_LOGGING_FILE' environment variable(more on
|
|
|
|
|
this later).
|
|
|
|
|
|
|
|
|
|
There is an additional support of logging Time and the name of
|
|
|
|
|
the `FT_COMPONENT' from which the current log is generated along
|
|
|
|
|
with the actual tracing and debugging message, and for this user
|
|
|
|
|
will have to define additional tags under the `FT2_DEBUG'
|
|
|
|
|
environment variable(More details under section `FT2_DEBUG' under
|
|
|
|
|
Environment Variables heading).
|
2002-07-09 01:02:32 +02:00
|
|
|
|
|
2002-07-26 11:09:10 +02:00
|
|
|
|
II. Debugging macros
|
|
|
|
|
--------------------
|
2002-07-09 01:02:32 +02:00
|
|
|
|
|
2013-11-13 08:55:46 +01:00
|
|
|
|
Several macros can be used within the FreeType sources to help
|
|
|
|
|
debugging its code:
|
2002-07-09 01:02:32 +02:00
|
|
|
|
|
* include/freetype/freetype.h, include/freetype/ftchapters.h: Add
a preliminary section with some explanations about user allocation.
* src/tools/docmaker/tohtml.py (HtmlFormatter.section_enter):
Don't abort if there are no data types, functions, etc., in a
section.
Print synopsis only if we have a data type, function, etc.
* docs/INSTALL.ANY, docs/INSTALL, docs/INSTALL.UNX, docs/CUSTOMIZE,
docs/INSTALL.GNU, docs/TRUETYPE, docs/DEBUG, docs/UPGRADE.UNX,
docs/VERSION.DLL, docs/formats.txt: Revised, formatted.
2005-08-30 02:22:46 +02:00
|
|
|
|
|
2002-07-26 11:09:10 +02:00
|
|
|
|
1. FT_ERROR(( ... ))
|
2002-07-09 01:02:32 +02:00
|
|
|
|
|
2013-11-13 08:55:46 +01:00
|
|
|
|
This macro is used to send debug messages that indicate relatively
|
2019-10-06 20:07:09 +02:00
|
|
|
|
serious errors (like broken font files) without stopping the
|
2013-11-13 08:55:46 +01:00
|
|
|
|
execution of the running program. Its code is compiled only when
|
2019-10-06 20:07:09 +02:00
|
|
|
|
either `FT_DEBUG_LEVEL_ERROR' or `FT_DEBUG_LEVEL_TRACE' are
|
|
|
|
|
defined in `ftoption.h'.
|
2002-07-09 01:02:32 +02:00
|
|
|
|
|
2013-11-13 08:55:46 +01:00
|
|
|
|
Note that you have to use a printf-like signature, but with double
|
* include/freetype/freetype.h, include/freetype/ftchapters.h: Add
a preliminary section with some explanations about user allocation.
* src/tools/docmaker/tohtml.py (HtmlFormatter.section_enter):
Don't abort if there are no data types, functions, etc., in a
section.
Print synopsis only if we have a data type, function, etc.
* docs/INSTALL.ANY, docs/INSTALL, docs/INSTALL.UNX, docs/CUSTOMIZE,
docs/INSTALL.GNU, docs/TRUETYPE, docs/DEBUG, docs/UPGRADE.UNX,
docs/VERSION.DLL, docs/formats.txt: Revised, formatted.
2005-08-30 02:22:46 +02:00
|
|
|
|
parentheses, like in
|
2002-07-09 01:02:32 +02:00
|
|
|
|
|
2002-07-26 11:09:10 +02:00
|
|
|
|
FT_ERROR(( "your %s is not %s\n", "foo", "bar" ));
|
2002-07-09 01:02:32 +02:00
|
|
|
|
|
|
|
|
|
|
2002-07-26 11:09:10 +02:00
|
|
|
|
2. FT_ASSERT( condition )
|
2002-07-09 01:02:32 +02:00
|
|
|
|
|
2013-11-13 08:55:46 +01:00
|
|
|
|
This macro is used to check strong assertions at runtime. If its
|
2019-10-06 20:07:09 +02:00
|
|
|
|
condition isn't TRUE, the program aborts with a panic message.
|
|
|
|
|
Its code is compiled when either `FT_DEBUG_LEVEL_ERROR' or
|
|
|
|
|
`FT_DEBUG_LEVEL_TRACE' are defined. You don't need double
|
|
|
|
|
parentheses here. Example:
|
2002-07-09 01:02:32 +02:00
|
|
|
|
|
2002-07-26 11:09:10 +02:00
|
|
|
|
FT_ASSERT( ptr != NULL );
|
2002-07-09 01:02:32 +02:00
|
|
|
|
|
|
|
|
|
|
2002-07-26 11:09:10 +02:00
|
|
|
|
3. FT_TRACE( level, (message...) )
|
2007-01-16 07:11:27 +01:00
|
|
|
|
|
2019-10-06 20:07:09 +02:00
|
|
|
|
The `FT_TRACE' macro is used to send general-purpose debugging
|
2013-11-13 08:55:46 +01:00
|
|
|
|
messages during program execution. This macro uses an *implicit*
|
2019-10-06 20:07:09 +02:00
|
|
|
|
macro named `FT_COMPONENT', which names the current FreeType
|
2013-11-13 08:55:46 +01:00
|
|
|
|
component being run.
|
2002-07-09 01:02:32 +02:00
|
|
|
|
|
2019-10-06 20:07:09 +02:00
|
|
|
|
The developer should always define `FT_COMPONENT' as appropriate,
|
2013-11-13 08:55:46 +01:00
|
|
|
|
for example as in
|
2002-07-09 01:02:32 +02:00
|
|
|
|
|
2002-07-26 11:09:10 +02:00
|
|
|
|
#undef FT_COMPONENT
|
2018-09-04 04:43:39 +02:00
|
|
|
|
#define FT_COMPONENT io
|
|
|
|
|
|
2019-10-06 20:07:09 +02:00
|
|
|
|
The value of the `FT_COMPONENT' macro is one of the component
|
|
|
|
|
names defined in the internal file `internal/fttrace.h'. If you
|
|
|
|
|
modify the FreeType source code and insert a new `FT_COMPONENT'
|
|
|
|
|
macro, you must register it in `fttrace.h'. If you insert or
|
|
|
|
|
remove many trace macros, you can test for undefined or unused
|
|
|
|
|
trace macros with the script `src/tools/chktrcmp.py'.
|
2002-07-09 01:02:32 +02:00
|
|
|
|
|
2019-10-06 20:07:09 +02:00
|
|
|
|
Each such component is assigned a `debug level', ranging from
|
|
|
|
|
value 0 to 7, through the use of the `FT2_DEBUG' environment
|
|
|
|
|
variable (described below) when a program linked with FreeType
|
|
|
|
|
starts.
|
2002-07-09 01:02:32 +02:00
|
|
|
|
|
2019-10-06 20:07:09 +02:00
|
|
|
|
When `FT_TRACE' is called, its level is compared to the one of the
|
2013-11-13 08:55:46 +01:00
|
|
|
|
corresponding component. Messages with trace levels *higher* than
|
2019-10-06 20:07:09 +02:00
|
|
|
|
the corresponding component level are filtered out and never
|
|
|
|
|
printed. This means that trace messages with level 0 are always
|
|
|
|
|
printed, those with level 2 are only printed when the component
|
|
|
|
|
level is *at least* 2, etc.
|
2002-07-09 01:02:32 +02:00
|
|
|
|
|
2019-10-06 20:07:09 +02:00
|
|
|
|
The second parameter to `FT_TRACE' must contain parentheses and
|
|
|
|
|
corresponds to a printf-like call, as in
|
2002-07-09 01:02:32 +02:00
|
|
|
|
|
2002-07-26 11:09:10 +02:00
|
|
|
|
FT_TRACE( 2, ( "your %s is not %s\n", "foo", "bar" ) )
|
2002-07-09 01:02:32 +02:00
|
|
|
|
|
2019-10-06 20:07:09 +02:00
|
|
|
|
The shortcut macros `FT_TRACE0', `FT_TRACE1', `FT_TRACE2', ...,
|
|
|
|
|
`FT_TRACE7' can be used with constant level indices, and are much
|
2013-11-13 08:55:46 +01:00
|
|
|
|
cleaner to use, as in
|
2002-07-09 01:02:32 +02:00
|
|
|
|
|
2013-11-13 08:55:46 +01:00
|
|
|
|
FT_TRACE2(( "your %s is not %s\n", "foo", "bar" ));
|
2002-07-09 01:02:32 +02:00
|
|
|
|
|
|
|
|
|
|
2002-07-26 11:09:10 +02:00
|
|
|
|
III. Environment variables
|
|
|
|
|
--------------------------
|
2002-07-09 01:02:32 +02:00
|
|
|
|
|
2013-11-13 08:55:46 +01:00
|
|
|
|
The following environment variables control debugging output and
|
* include/freetype/freetype.h, include/freetype/ftchapters.h: Add
a preliminary section with some explanations about user allocation.
* src/tools/docmaker/tohtml.py (HtmlFormatter.section_enter):
Don't abort if there are no data types, functions, etc., in a
section.
Print synopsis only if we have a data type, function, etc.
* docs/INSTALL.ANY, docs/INSTALL, docs/INSTALL.UNX, docs/CUSTOMIZE,
docs/INSTALL.GNU, docs/TRUETYPE, docs/DEBUG, docs/UPGRADE.UNX,
docs/VERSION.DLL, docs/formats.txt: Revised, formatted.
2005-08-30 02:22:46 +02:00
|
|
|
|
behaviour of FreeType at runtime.
|
|
|
|
|
|
2002-07-09 01:02:32 +02:00
|
|
|
|
|
|
|
|
|
FT2_DEBUG
|
|
|
|
|
|
2013-11-13 08:55:46 +01:00
|
|
|
|
This variable is only used when FreeType is built with
|
2019-10-06 20:07:09 +02:00
|
|
|
|
`FT_DEBUG_LEVEL_TRACE' defined. It contains a list of component
|
2013-11-13 08:55:46 +01:00
|
|
|
|
level definitions, following this format:
|
2002-07-26 11:09:10 +02:00
|
|
|
|
|
2013-11-13 08:55:46 +01:00
|
|
|
|
component1:level1 component2:level2 component3:level3 ...
|
2002-07-09 01:02:32 +02:00
|
|
|
|
|
2013-11-13 08:55:46 +01:00
|
|
|
|
where `componentX' is the name of a tracing component, as defined
|
2018-09-04 04:43:39 +02:00
|
|
|
|
in `fttrace.h'. `levelX' is the corresponding level to use at
|
|
|
|
|
runtime.
|
2002-07-09 01:02:32 +02:00
|
|
|
|
|
2019-10-06 20:07:09 +02:00
|
|
|
|
`any' is a special component name that is interpreted as `any/all
|
|
|
|
|
components'. For example, the following definitions
|
2002-07-09 01:02:32 +02:00
|
|
|
|
|
2013-11-13 08:55:46 +01:00
|
|
|
|
set FT2_DEBUG=any:2 memory:5 io:4 (on Windows)
|
|
|
|
|
export FT2_DEBUG="any:2 memory:5 io:4" (on Linux with bash)
|
2002-07-09 01:02:32 +02:00
|
|
|
|
|
2013-11-13 08:55:46 +01:00
|
|
|
|
both stipulate that all components should have level 2, except for
|
2019-10-06 20:07:09 +02:00
|
|
|
|
the memory and io components, which are set to the trace levels 5
|
2013-11-13 08:55:46 +01:00
|
|
|
|
and 4, respectively.
|
* include/freetype/freetype.h, include/freetype/ftchapters.h: Add
a preliminary section with some explanations about user allocation.
* src/tools/docmaker/tohtml.py (HtmlFormatter.section_enter):
Don't abort if there are no data types, functions, etc., in a
section.
Print synopsis only if we have a data type, function, etc.
* docs/INSTALL.ANY, docs/INSTALL, docs/INSTALL.UNX, docs/CUSTOMIZE,
docs/INSTALL.GNU, docs/TRUETYPE, docs/DEBUG, docs/UPGRADE.UNX,
docs/VERSION.DLL, docs/formats.txt: Revised, formatted.
2005-08-30 02:22:46 +02:00
|
|
|
|
|
2020-08-28 07:58:17 +02:00
|
|
|
|
`FT_LOGGING' related tags:
|
|
|
|
|
|
|
|
|
|
As mentioned above in the `FT_LOGGING' section below are the
|
|
|
|
|
additional tags which can be added in `FT2_DEBUG' environment
|
|
|
|
|
variable to log the time and the value of `FT_COMPONENT' in the
|
|
|
|
|
actual log message:
|
|
|
|
|
* -v: For printing the name of FreeType's component from which
|
|
|
|
|
the current log is produced.
|
|
|
|
|
* -t: For printing the time(in milliseconds) along with actual
|
|
|
|
|
log message.
|
|
|
|
|
|
|
|
|
|
Example:
|
|
|
|
|
|
|
|
|
|
Case 1: FT2_DEBUG="any:7 memory:5 -vt"
|
|
|
|
|
|
|
|
|
|
[20:32:02:44969 ttload] table directory loaded
|
|
|
|
|
|
|
|
|
|
Case 2: FT2_DEBUG="any:7 memory:5 -t"
|
|
|
|
|
|
|
|
|
|
[20:32:02:44969 ttload] table directory loaded
|
|
|
|
|
|
|
|
|
|
Case 3: FT2_DEBUG="any:7 memory:5 -v"
|
|
|
|
|
|
|
|
|
|
[ttload] table directory loaded
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FT_LOGGING_FILE
|
|
|
|
|
|
|
|
|
|
This variable is only used when FreeType is built with
|
|
|
|
|
`FT_LOGGING' macro defined. It contains the path to the file where
|
|
|
|
|
the user wants to put his log file.
|
|
|
|
|
|
|
|
|
|
On Linux with bash:
|
|
|
|
|
export FT_LOGGING_FILE="/tmp/freetype2.log"
|
|
|
|
|
|
|
|
|
|
On Windows:
|
|
|
|
|
set FT_LOGGING_FILE=C:\Users\AppData\Local\Temp\freetype2.log
|
|
|
|
|
|
|
|
|
|
Use the following `FT_LOGGING_FILE' value to print logs to stderr.
|
|
|
|
|
|
|
|
|
|
export FT_LOGGING_FILE=/dev/stderr
|
|
|
|
|
|
2002-07-09 01:02:32 +02:00
|
|
|
|
|
|
|
|
|
FT2_DEBUG_MEMORY
|
|
|
|
|
|
2013-11-13 08:55:46 +01:00
|
|
|
|
This environment variable, when defined, tells FreeType to use a
|
2019-10-06 20:07:09 +02:00
|
|
|
|
debugging memory manager that tracks leaking memory blocks as well
|
|
|
|
|
as other common errors like double frees. It is also capable of
|
|
|
|
|
reporting _where_ the leaking blocks were allocated, which
|
2013-11-13 08:55:46 +01:00
|
|
|
|
considerably saves time when debugging new additions to the
|
|
|
|
|
library.
|
2002-07-09 01:02:32 +02:00
|
|
|
|
|
2013-11-13 08:55:46 +01:00
|
|
|
|
This code is only compiled when FreeType is built with the
|
2019-10-06 20:07:09 +02:00
|
|
|
|
`FT_DEBUG_MEMORY' macro #defined in `ftoption.h' though, it is
|
2002-07-26 11:09:10 +02:00
|
|
|
|
ignored in other builds.
|
2002-07-09 01:02:32 +02:00
|
|
|
|
|
* include/freetype/freetype.h, include/freetype/ftchapters.h: Add
a preliminary section with some explanations about user allocation.
* src/tools/docmaker/tohtml.py (HtmlFormatter.section_enter):
Don't abort if there are no data types, functions, etc., in a
section.
Print synopsis only if we have a data type, function, etc.
* docs/INSTALL.ANY, docs/INSTALL, docs/INSTALL.UNX, docs/CUSTOMIZE,
docs/INSTALL.GNU, docs/TRUETYPE, docs/DEBUG, docs/UPGRADE.UNX,
docs/VERSION.DLL, docs/formats.txt: Revised, formatted.
2005-08-30 02:22:46 +02:00
|
|
|
|
|
2003-03-13 22:07:51 +01:00
|
|
|
|
FT2_ALLOC_TOTAL_MAX
|
|
|
|
|
|
2019-10-06 20:07:09 +02:00
|
|
|
|
This variable is ignored if `FT2_DEBUG_MEMORY' is not defined. It
|
2013-11-13 08:55:46 +01:00
|
|
|
|
allows you to specify a maximum heap size for all memory
|
|
|
|
|
allocations performed by FreeType. This is very useful to test
|
|
|
|
|
the robustness of the font engine and programs that use it in
|
|
|
|
|
tight memory conditions.
|
2007-01-16 07:11:27 +01:00
|
|
|
|
|
2019-10-06 20:07:09 +02:00
|
|
|
|
If it is undefined, or if its value is not strictly positive, no
|
|
|
|
|
allocation bounds are checked at runtime.
|
2003-03-13 22:07:51 +01:00
|
|
|
|
|
* include/freetype/freetype.h, include/freetype/ftchapters.h: Add
a preliminary section with some explanations about user allocation.
* src/tools/docmaker/tohtml.py (HtmlFormatter.section_enter):
Don't abort if there are no data types, functions, etc., in a
section.
Print synopsis only if we have a data type, function, etc.
* docs/INSTALL.ANY, docs/INSTALL, docs/INSTALL.UNX, docs/CUSTOMIZE,
docs/INSTALL.GNU, docs/TRUETYPE, docs/DEBUG, docs/UPGRADE.UNX,
docs/VERSION.DLL, docs/formats.txt: Revised, formatted.
2005-08-30 02:22:46 +02:00
|
|
|
|
|
2003-03-13 22:07:51 +01:00
|
|
|
|
FT2_ALLOC_COUNT_MAX
|
2007-01-16 07:11:27 +01:00
|
|
|
|
|
2019-10-06 20:07:09 +02:00
|
|
|
|
This variable is ignored if `FT2_DEBUG_MEMORY' is not defined. It
|
2013-11-13 08:55:46 +01:00
|
|
|
|
allows you to specify a maximum number of memory allocations
|
|
|
|
|
performed by FreeType before returning the error
|
2019-10-06 20:07:09 +02:00
|
|
|
|
`FT_Err_Out_Of_Memory'. This is useful for debugging and testing
|
2013-11-13 08:55:46 +01:00
|
|
|
|
the engine's robustness.
|
2007-01-16 07:11:27 +01:00
|
|
|
|
|
2019-10-06 20:07:09 +02:00
|
|
|
|
If it is undefined, or if its value is not strictly positive, no
|
|
|
|
|
allocation bounds are checked at runtime.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FT2_KEEP_ALIVE
|
|
|
|
|
|
|
|
|
|
This variable is ignored if `FT2_DEBUG_MEMORY' is not defined.
|
|
|
|
|
`Keep alive' means that freed blocks aren't released to the heap.
|
|
|
|
|
This is useful to detect double-frees or weird heap corruption,
|
|
|
|
|
reporting the source code location of the original allocation and
|
|
|
|
|
deallocation in case of a problem. It uses large amounts of
|
|
|
|
|
memory, however.
|
|
|
|
|
|
|
|
|
|
If it is undefined, or if its value is not strictly positive,
|
|
|
|
|
freed blocks are released at runtime.
|
2003-04-21 15:30:27 +02:00
|
|
|
|
|
2020-08-28 07:58:17 +02:00
|
|
|
|
|
|
|
|
|
IV. Additional Capabilities with `FT_LOGGING'
|
|
|
|
|
--------------------------------------------
|
|
|
|
|
|
|
|
|
|
With the support of `FT_LOGGING', four APIs have been introduced for
|
|
|
|
|
providing additional debugging support to the applications using
|
|
|
|
|
FreeType.
|
|
|
|
|
|
|
|
|
|
FT_Trace_Set_Level( const char* )
|
|
|
|
|
|
|
|
|
|
If FreeType is configured with `FT_LOGGING' the levels of tracing
|
|
|
|
|
component set using `FT2_DEBUG' environment variable is considered
|
|
|
|
|
as a default value.
|
|
|
|
|
And this function can be used change/set the value of the levels
|
|
|
|
|
of tracing components at run-time.
|
|
|
|
|
|
|
|
|
|
NOTE: If the environment variable `FT2_DEBUG is not defined the
|
|
|
|
|
default value of the levels of tracing components will be NULL.
|
|
|
|
|
|
|
|
|
|
FT_Trace_Set_Default_Level():
|
|
|
|
|
|
|
|
|
|
If previously, `FT_Trace_Set_Level' functions is used to set new
|
|
|
|
|
values of the tracing components of FreeType, this function could
|
|
|
|
|
be used to reset the level of tracing components to the default
|
|
|
|
|
value.
|
|
|
|
|
Hence, the functions `FT_Trace_Set_Default_Level' and
|
|
|
|
|
`FT_Trace_Set_Level' could be combined and used together to
|
|
|
|
|
change the trace levels of FreeType's components for a particular
|
|
|
|
|
block of code.
|
|
|
|
|
|
|
|
|
|
FT_Set_Log_Handler( ft_custom_log_handler ):
|
|
|
|
|
|
|
|
|
|
This API has been provided under the `FT_LOGGING' macro to support
|
|
|
|
|
a feature wherein a custom log handler can be provided based on
|
|
|
|
|
user’s choice. Doing so, FreeType will start calling the custom
|
|
|
|
|
handler for new log messages and will no longer write these
|
|
|
|
|
messages in predefined log file of FreeType. It will totally
|
|
|
|
|
depend on user how the log messages will be handled.
|
|
|
|
|
User just need to call this API with an argument of type
|
|
|
|
|
ft_custom_log_handler which should match following function
|
|
|
|
|
prototype:
|
|
|
|
|
|
|
|
|
|
void (*ft_custom_log_handler)( const char* ft_component,
|
|
|
|
|
const char* fmt,
|
|
|
|
|
va_list args );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FT_Set_Default_Log_Handler():
|
|
|
|
|
|
|
|
|
|
If the user has chosen to set a custom log handler using the
|
|
|
|
|
`FT_Set_Log_Handler' API above, the current API can be used to
|
|
|
|
|
reset back the log handler to the Freetype's inbuilt log handler.
|
|
|
|
|
Hence, the functions `FT_Set_Default_Log_Handler' and
|
|
|
|
|
`FT_Set_Log_Handler' in combination can be used to separately
|
|
|
|
|
handle the trace or error logs generated by a particular block
|
|
|
|
|
of code.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Applications need to #include the following header file to avail the
|
|
|
|
|
above APIs:
|
|
|
|
|
|
|
|
|
|
#include<freetype/ftlogging.h>
|
|
|
|
|
|
2005-06-05 01:00:25 +02:00
|
|
|
|
------------------------------------------------------------------------
|
|
|
|
|
|
2020-01-19 17:05:19 +01:00
|
|
|
|
Copyright (C) 2002-2020 by
|
2005-06-05 01:00:25 +02:00
|
|
|
|
David Turner, Robert Wilhelm, and Werner Lemberg.
|
|
|
|
|
|
* include/freetype/freetype.h, include/freetype/ftchapters.h: Add
a preliminary section with some explanations about user allocation.
* src/tools/docmaker/tohtml.py (HtmlFormatter.section_enter):
Don't abort if there are no data types, functions, etc., in a
section.
Print synopsis only if we have a data type, function, etc.
* docs/INSTALL.ANY, docs/INSTALL, docs/INSTALL.UNX, docs/CUSTOMIZE,
docs/INSTALL.GNU, docs/TRUETYPE, docs/DEBUG, docs/UPGRADE.UNX,
docs/VERSION.DLL, docs/formats.txt: Revised, formatted.
2005-08-30 02:22:46 +02:00
|
|
|
|
This file is part of the FreeType project, and may only be used,
|
|
|
|
|
modified, and distributed under the terms of the FreeType project
|
|
|
|
|
license, LICENSE.TXT. By continuing to use, modify, or distribute this
|
|
|
|
|
file you indicate that you have read the license and understand and
|
2005-06-05 01:00:25 +02:00
|
|
|
|
accept it fully.
|
|
|
|
|
|
2003-03-13 22:07:51 +01:00
|
|
|
|
|
2003-04-21 15:30:27 +02:00
|
|
|
|
--- end of DEBUG ---
|