Skip to content

Commit

Permalink
Update FreeType to 2.13.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Dutchman101 committed Sep 27, 2023
1 parent 85e707b commit a783e99
Show file tree
Hide file tree
Showing 142 changed files with 5,717 additions and 6,384 deletions.
1,604 changes: 1,604 additions & 0 deletions vendor/freetype/ChangeLog

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions vendor/freetype/README
@@ -1,4 +1,4 @@
FreeType 2.13.0
FreeType 2.13.2
===============

Homepage: https://www.freetype.org
Expand Down Expand Up @@ -32,9 +32,9 @@ sites. Go to

and download one of the following files.

freetype-doc-2.13.0.tar.xz
freetype-doc-2.13.0.tar.gz
ftdoc2130.zip
freetype-doc-2.13.2.tar.xz
freetype-doc-2.13.2.tar.gz
ftdoc2132.zip

To view the documentation online, go to

Expand Down
190 changes: 105 additions & 85 deletions vendor/freetype/include/dlg/dlg.h
Expand Up @@ -85,6 +85,13 @@
#endif
#endif

// This macro is used when an assertion fails. It gets the source expression
// and can return an alternative (that must stay alive).
// Mainly useful to execute something on failed assertion.
#ifndef DLG_FAILED_ASSERTION_TEXT
#define DLG_FAILED_ASSERTION_TEXT(x) x
#endif

// - utility -
// two methods needed since cplusplus does not support compound literals
// and c does not support uniform initialization/initializer lists
Expand Down Expand Up @@ -131,116 +138,111 @@ struct dlg_origin {
// Type of the output handler, see dlg_set_handler.
typedef void(*dlg_handler)(const struct dlg_origin* origin, const char* string, void* data);

#ifdef DLG_DISABLE
#ifndef DLG_DISABLE
// Tagged/Untagged logging with variable level
// Tags must always be in the format `("tag1", "tag2")` (including brackets)
#define dlg_log(level, ...)
#define dlg_logt(level, tags, ...)

// Dynamic level assert macros in various versions for additional arguments
#define dlg_assertl(level, expr) // assert without tags/message
#define dlg_assertlt(level, tags, expr) // assert with tags
#define dlg_assertlm(level, expr, ...) // assert with message
#define dlg_assertltm(level, tags, expr, ...) // assert with tags & message

// Sets the handler that is responsible for formatting and outputting log calls.
// This function is not thread safe and the handler is set globally.
// The handler itself must not change dlg tags or call a dlg macro (if it
// does so, the provided string or tags array in 'origin' might get invalid).
// The handler can also be used for various other things such as dealing
// with failed assertions or filtering calls based on the passed tags.
// The default handler is dlg_default_output (see its doc for more info).
// If using c++ make sure the registered handler cannot throw e.g. by
// wrapping everything into a try-catch blog.
inline void dlg_set_handler(dlg_handler handler, void* data) {
(void) handler;
(void) data;
}

// Returns the currently active dlg handler and sets `data` to
// its user data pointer. `data` must not be NULL.
// Useful to create handler chains.
// This function is not threadsafe, i.e. retrieving the handler while
// changing it from another thread is unsafe.
// See `dlg_set_handler`.
inline dlg_handler dlg_get_handler(void** data) {
*data = NULL;
return NULL;
}

// The default output handler.
// Only use this to reset the output handler, prefer to use
// dlg_generic_output (from output.h) which this function simply calls.
// It also flushes the stream used and correctly outputs even from multiple threads.
inline void dlg_default_output(const struct dlg_origin* o, const char* str, void* data) {
(void) o;
(void) str;
(void) data;
}

// Adds the given tag associated with the given function to the thread specific list.
// If func is not NULL the tag will only applied to calls from the same function.
// Remove the tag again calling dlg_remove_tag (with exactly the same pointers!).
// Does not check if the tag is already present.
inline void dlg_add_tag(const char* tag, const char* func) {
(void) tag;
(void) func;
}

// Removes a tag added with dlg_add_tag (has no effect for tags no present).
// The pointers must be exactly the same pointers that were supplied to dlg_add_tag,
// this function will not check using strcmp. When the same tag/func combination
// is added multiple times, this function remove exactly one candidate, it is
// undefined which. Returns whether a tag was found (and removed).
inline bool dlg_remove_tag(const char* tag, const char* func) {
(void) tag;
(void) func;
return true;
}

// Returns the thread-specific buffer and its size for dlg.
// The buffer should only be used by formatting functions.
// The buffer can be reallocated and the size changed, just make sure
// to update both values correctly.
inline char** dlg_thread_buffer(size_t** size) {
(void) size;
return NULL;
}

#else // DLG_DISABLE
// Example usages:
// dlg_log(dlg_level_warning, "test 1")
// dlg_logt(("tag1, "tag2"), dlg_level_debug, "test %d", 2)
#define dlg_log(level, ...) if(level >= DLG_LOG_LEVEL) \
dlg__do_log(level, DLG_CREATE_TAGS(NULL), DLG_FILE, __LINE__, __func__, \
DLG_FMT_FUNC(__VA_ARGS__), NULL)
#define dlg_logt(level, tags, ...) if(level >= DLG_LOG_LEVEL) \
dlg__do_log(level, DLG_CREATE_TAGS tags, DLG_FILE, __LINE__, __func__, \
DLG_FMT_FUNC(__VA_ARGS__), NULL)

// Dynamic level assert macros in various versions for additional arguments
// Example usages:
// dlg_assertl(dlg_level_warning, data != nullptr);
// dlg_assertlt(("tag1, "tag2"), dlg_level_trace, data != nullptr);
// dlg_asserttlm(("tag1), dlg_level_warning, data != nullptr, "Data must not be null");
// dlg_assertlm(dlg_level_error, data != nullptr, "Data must not be null");
#define dlg_assertl(level, expr) if(level >= DLG_ASSERT_LEVEL && !(expr)) \
dlg__do_log(level, DLG_CREATE_TAGS(NULL), DLG_FILE, __LINE__, __func__, NULL, #expr)
dlg__do_log(level, DLG_CREATE_TAGS(NULL), DLG_FILE, __LINE__, __func__, NULL, \
DLG_FAILED_ASSERTION_TEXT(#expr))
#define dlg_assertlt(level, tags, expr) if(level >= DLG_ASSERT_LEVEL && !(expr)) \
dlg__do_log(level, DLG_CREATE_TAGS tags, DLG_FILE, __LINE__, __func__, NULL, #expr)
dlg__do_log(level, DLG_CREATE_TAGS tags, DLG_FILE, __LINE__, __func__, NULL, \
DLG_FAILED_ASSERTION_TEXT(#expr))
#define dlg_assertlm(level, expr, ...) if(level >= DLG_ASSERT_LEVEL && !(expr)) \
dlg__do_log(level, DLG_CREATE_TAGS(NULL), DLG_FILE, __LINE__, __func__, \
DLG_FMT_FUNC(__VA_ARGS__), #expr)
DLG_FMT_FUNC(__VA_ARGS__), DLG_FAILED_ASSERTION_TEXT(#expr))
#define dlg_assertltm(level, tags, expr, ...) if(level >= DLG_ASSERT_LEVEL && !(expr)) \
dlg__do_log(level, DLG_CREATE_TAGS tags, DLG_FILE, __LINE__, \
__func__, DLG_FMT_FUNC(__VA_ARGS__), #expr)
__func__, DLG_FMT_FUNC(__VA_ARGS__), DLG_FAILED_ASSERTION_TEXT(#expr))

DLG_API void dlg_set_handler(dlg_handler handler, void* data);
DLG_API dlg_handler dlg_get_handler(void** data);
DLG_API void dlg_default_output(const struct dlg_origin*, const char* string, void*);
DLG_API void dlg_add_tag(const char* tag, const char* func);
DLG_API bool dlg_remove_tag(const char* tag, const char* func);
DLG_API char** dlg_thread_buffer(size_t** size);
#define dlg__assert_or(level, tags, expr, code, msg) if(!(expr)) {\
if(level >= DLG_ASSERT_LEVEL) \
dlg__do_log(level, tags, DLG_FILE, __LINE__, __func__, msg, \
DLG_FAILED_ASSERTION_TEXT(#expr)); \
code; \
} (void) NULL

// - Private interface: not part of the abi/api but needed in macros -
// Formats the given format string and arguments as printf would, uses the thread buffer.
DLG_API const char* dlg__printf_format(const char* format, ...) DLG_PRINTF_ATTRIB(1, 2);
DLG_API void dlg__do_log(enum dlg_level lvl, const char* const*, const char*, int,
const char*, const char*, const char*);
DLG_API const char* dlg__strip_root_path(const char* file, const char* base);

#else // DLG_DISABLE

#define dlg_log(level, ...)
#define dlg_logt(level, tags, ...)

#define dlg_assertl(level, expr) // assert without tags/message
#define dlg_assertlt(level, tags, expr) // assert with tags
#define dlg_assertlm(level, expr, ...) // assert with message
#define dlg_assertltm(level, tags, expr, ...) // assert with tags & message

#define dlg__assert_or(level, tags, expr, code, msg) if(!(expr)) { code; } (void) NULL
#endif // DLG_DISABLE

// The API below is independent from DLG_DISABLE

// Sets the handler that is responsible for formatting and outputting log calls.
// This function is not thread safe and the handler is set globally.
// The handler itself must not change dlg tags or call a dlg macro (if it
// does so, the provided string or tags array in 'origin' might get invalid).
// The handler can also be used for various other things such as dealing
// with failed assertions or filtering calls based on the passed tags.
// The default handler is dlg_default_output (see its doc for more info).
// If using c++ make sure the registered handler cannot throw e.g. by
// wrapping everything into a try-catch blog.
DLG_API void dlg_set_handler(dlg_handler handler, void* data);

// The default output handler.
// Only use this to reset the output handler, prefer to use
// dlg_generic_output (from output.h) which this function simply calls.
// It also flushes the stream used and correctly outputs even from multiple threads.
DLG_API void dlg_default_output(const struct dlg_origin*, const char* string, void*);

// Returns the currently active dlg handler and sets `data` to
// its user data pointer. `data` must not be NULL.
// Useful to create handler chains.
// This function is not threadsafe, i.e. retrieving the handler while
// changing it from another thread is unsafe.
// See `dlg_set_handler`.
DLG_API dlg_handler dlg_get_handler(void** data);

// Adds the given tag associated with the given function to the thread specific list.
// If func is not NULL the tag will only applied to calls from the same function.
// Remove the tag again calling dlg_remove_tag (with exactly the same pointers!).
// Does not check if the tag is already present.
DLG_API void dlg_add_tag(const char* tag, const char* func);

// Removes a tag added with dlg_add_tag (has no effect for tags no present).
// The pointers must be exactly the same pointers that were supplied to dlg_add_tag,
// this function will not check using strcmp. When the same tag/func combination
// is added multiple times, this function remove exactly one candidate, it is
// undefined which. Returns whether a tag was found (and removed).
DLG_API bool dlg_remove_tag(const char* tag, const char* func);

// Returns the thread-specific buffer and its size for dlg.
// The buffer should only be used by formatting functions.
// The buffer can be reallocated and the size changed, just make sure
// to update both values correctly.
DLG_API char** dlg_thread_buffer(size_t** size);

// Untagged leveled logging
#define dlg_trace(...) dlg_log(dlg_level_trace, __VA_ARGS__)
#define dlg_debug(...) dlg_log(dlg_level_debug, __VA_ARGS__)
Expand All @@ -263,6 +265,24 @@ typedef void(*dlg_handler)(const struct dlg_origin* origin, const char* string,
#define dlg_assertm(expr, ...) dlg_assertlm(DLG_DEFAULT_ASSERT, expr, __VA_ARGS__)
#define dlg_asserttm(tags, expr, ...) dlg_assertltm(DLG_DEFAULT_ASSERT, tags, expr, __VA_ARGS__)

// If (expr) does not evaluate to true, always executes 'code' (no matter what
// DLG_ASSERT_LEVEL is or if dlg is disabled or not).
// When dlg is enabled and the level is greater or equal to DLG_ASSERT_LEVEL,
// logs the failed assertion.
// Example usages:
// dlg_assertl_or(dlg_level_warn, data != nullptr, return);
// dlg_assertlm_or(dlg_level_fatal, data != nullptr, return, "Data must not be null");
// dlg_assert_or(data != nullptr, logError(); return false);
#define dlg_assertltm_or(level, tags, expr, code, ...) dlg__assert_or(level, \
DLG_CREATE_TAGS tags, expr, code, DLG_FMT_FUNC(__VA_ARGS__))
#define dlg_assertlm_or(level, expr, code, ...) dlg__assert_or(level, \
DLG_CREATE_TAGS(NULL), expr, code, DLG_FMT_FUNC(__VA_ARGS__))
#define dlg_assertl_or(level, expr, code) dlg__assert_or(level, \
DLG_CREATE_TAGS(NULL), expr, code, NULL)

#define dlg_assert_or(expr, code) dlg_assertl_or(DLG_DEFAULT_ASSERT, expr, code)
#define dlg_assertm_or(expr, code, ...) dlg_assertlm_or(DLG_DEFAULT_ASSERT, expr, code, __VA_ARGS__)

#ifdef __cplusplus
}
#endif
Expand Down
47 changes: 7 additions & 40 deletions vendor/freetype/include/freetype/config/ftoption.h
Expand Up @@ -661,36 +661,12 @@ FT_BEGIN_HEADER
* not) instructions in a certain way so that all TrueType fonts look like
* they do in a Windows ClearType (DirectWrite) environment. See [1] for a
* technical overview on what this means. See `ttinterp.h` for more
* details on the LEAN option.
* details on this option.
*
* There are three possible values.
*
* Value 1:
* This value is associated with the 'Infinality' moniker, contributed by
* an individual nicknamed Infinality with the goal of making TrueType
* fonts render better than on Windows. A high amount of configurability
* and flexibility, down to rules for single glyphs in fonts, but also
* very slow. Its experimental and slow nature and the original
* developer losing interest meant that this option was never enabled in
* default builds.
*
* The corresponding interpreter version is v38.
*
* Value 2:
* The new default mode for the TrueType driver. The Infinality code
* base was stripped to the bare minimum and all configurability removed
* in the name of speed and simplicity. The configurability was mainly
* aimed at legacy fonts like 'Arial', 'Times New Roman', or 'Courier'.
* Legacy fonts are fonts that modify vertical stems to achieve clean
* black-and-white bitmaps. The new mode focuses on applying a minimal
* set of rules to all fonts indiscriminately so that modern and web
* fonts render well while legacy fonts render okay.
*
* The corresponding interpreter version is v40.
*
* Value 3:
* Compile both, making both v38 and v40 available (the latter is the
* default).
* The new default mode focuses on applying a minimal set of rules to all
* fonts indiscriminately so that modern and web fonts render well while
* legacy fonts render okay. The corresponding interpreter version is v40.
* The so-called Infinality mode (v38) is no longer available in FreeType.
*
* By undefining these, you get rendering behavior like on Windows without
* ClearType, i.e., Windows XP without ClearType enabled and Win9x
Expand All @@ -705,9 +681,7 @@ FT_BEGIN_HEADER
* [1]
* https://www.microsoft.com/typography/cleartype/truetypecleartype.aspx
*/
/* #define TT_CONFIG_OPTION_SUBPIXEL_HINTING 1 */
#define TT_CONFIG_OPTION_SUBPIXEL_HINTING 2
/* #define TT_CONFIG_OPTION_SUBPIXEL_HINTING ( 1 | 2 ) */
#define TT_CONFIG_OPTION_SUBPIXEL_HINTING
/**************************************************************************
Expand Down Expand Up @@ -977,21 +951,14 @@ FT_BEGIN_HEADER


/*
* The next three macros are defined if native TrueType hinting is
* The next two macros are defined if native TrueType hinting is
* requested by the definitions above. Don't change this.
*/
#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
#define TT_USE_BYTECODE_INTERPRETER

#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING
#if TT_CONFIG_OPTION_SUBPIXEL_HINTING & 1
#define TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
#endif

#if TT_CONFIG_OPTION_SUBPIXEL_HINTING & 2
#define TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
#endif
#endif
#endif


Expand Down
14 changes: 7 additions & 7 deletions vendor/freetype/include/freetype/config/ftstdlib.h
Expand Up @@ -111,13 +111,13 @@

#include <stdio.h>

#define FT_FILE FILE
#define ft_fclose fclose
#define ft_fopen fopen
#define ft_fread fread
#define ft_fseek fseek
#define ft_ftell ftell
#define ft_sprintf sprintf
#define FT_FILE FILE
#define ft_fclose fclose
#define ft_fopen fopen
#define ft_fread fread
#define ft_fseek fseek
#define ft_ftell ftell
#define ft_snprintf snprintf


/**************************************************************************
Expand Down

0 comments on commit a783e99

Please sign in to comment.