Upgrade to Freetype 2.13.2
Task-number: QTBUG-117135 Pick-to: 6.5.3 6.2 5.15 Change-Id: I2485cf286f590eccee9c4be4bb19559631288fd5 Reviewed-by: Christian Strømme <christian.stromme@qt.io> (cherry picked from commit 5641a5e1e54c9694a1ba1d462165db9c7c0e529c) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> (cherry picked from commit b2e888dc812762df9054e982929a894a1fab8a52)
This commit is contained in:
parent
b5183fd230
commit
0449c4b4ea
8
src/3rdparty/freetype/README
vendored
8
src/3rdparty/freetype/README
vendored
@ -1,4 +1,4 @@
|
||||
FreeType 2.13.1
|
||||
FreeType 2.13.2
|
||||
===============
|
||||
|
||||
Homepage: https://www.freetype.org
|
||||
@ -32,9 +32,9 @@ sites. Go to
|
||||
|
||||
and download one of the following files.
|
||||
|
||||
freetype-doc-2.13.1.tar.xz
|
||||
freetype-doc-2.13.1.tar.gz
|
||||
ftdoc2131.zip
|
||||
freetype-doc-2.13.2.tar.xz
|
||||
freetype-doc-2.13.2.tar.gz
|
||||
ftdoc2132.zip
|
||||
|
||||
To view the documentation online, go to
|
||||
|
||||
|
14
src/3rdparty/freetype/docs/CHANGES
vendored
14
src/3rdparty/freetype/docs/CHANGES
vendored
@ -1,3 +1,17 @@
|
||||
CHANGES BETWEEN 2.13.1 and 2.13.2 (2023-Aug-25)
|
||||
|
||||
I. MISCELLANEOUS
|
||||
|
||||
- Better support for CFF2 variation fonts.
|
||||
|
||||
- TrueType interpreter version 38 (also known as 'Infinality') has
|
||||
been removed.
|
||||
|
||||
- Improved OpenVMS support.
|
||||
|
||||
|
||||
======================================================================
|
||||
|
||||
CHANGES BETWEEN 2.13.0 and 2.13.1 (2023-Jun-24)
|
||||
|
||||
I. MISCELLANEOUS
|
||||
|
190
src/3rdparty/freetype/include/dlg/dlg.h
vendored
190
src/3rdparty/freetype/include/dlg/dlg.h
vendored
@ -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
|
||||
@ -131,83 +138,12 @@ 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)
|
||||
@ -215,23 +151,31 @@ typedef void(*dlg_handler)(const struct dlg_origin* origin, const char* string,
|
||||
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.
|
||||
@ -239,8 +183,66 @@ typedef void(*dlg_handler)(const struct dlg_origin* origin, const char* string,
|
||||
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__)
|
||||
@ -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
|
||||
|
@ -5222,7 +5222,7 @@ FT_BEGIN_HEADER
|
||||
*/
|
||||
#define FREETYPE_MAJOR 2
|
||||
#define FREETYPE_MINOR 13
|
||||
#define FREETYPE_PATCH 1
|
||||
#define FREETYPE_PATCH 2
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
|
@ -332,9 +332,9 @@ FT_BEGIN_HEADER
|
||||
* Based on geometric considerations we use the following inequality to
|
||||
* identify a degenerate matrix.
|
||||
*
|
||||
* 50 * abs(xx*yy - xy*yx) < xx^2 + xy^2 + yx^2 + yy^2
|
||||
* 32 * abs(xx*yy - xy*yx) < xx^2 + xy^2 + yx^2 + yy^2
|
||||
*
|
||||
* Value 50 is heuristic.
|
||||
* Value 32 is heuristic.
|
||||
*/
|
||||
FT_BASE( FT_Bool )
|
||||
FT_Matrix_Check( const FT_Matrix* matrix );
|
||||
|
@ -1394,14 +1394,6 @@ FT_BEGIN_HEADER
|
||||
* vert_metrics_offset ::
|
||||
* The file offset of the 'vmtx' table.
|
||||
*
|
||||
* sph_found_func_flags ::
|
||||
* Flags identifying special bytecode functions (used by the v38
|
||||
* implementation of the bytecode interpreter).
|
||||
*
|
||||
* sph_compatibility_mode ::
|
||||
* This flag is set if we are in ClearType backward compatibility mode
|
||||
* (used by the v38 implementation of the bytecode interpreter).
|
||||
*
|
||||
* ebdt_start ::
|
||||
* The file offset of the sbit data table (CBDT, bdat, etc.).
|
||||
*
|
||||
@ -1597,13 +1589,6 @@ FT_BEGIN_HEADER
|
||||
FT_ULong horz_metrics_offset;
|
||||
FT_ULong vert_metrics_offset;
|
||||
|
||||
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
|
||||
/* since 2.4.12 */
|
||||
FT_ULong sph_found_func_flags; /* special functions found */
|
||||
/* for this face */
|
||||
FT_Bool sph_compatibility_mode;
|
||||
#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
|
||||
|
||||
#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
|
||||
/* since 2.7 */
|
||||
FT_ULong ebdt_start; /* either `CBDT', `EBDT', or `bdat' */
|
||||
|
4
src/3rdparty/freetype/qt_attribution.json
vendored
4
src/3rdparty/freetype/qt_attribution.json
vendored
@ -8,8 +8,8 @@
|
||||
|
||||
"Description": "FreeType is a freely available software library to render fonts.",
|
||||
"Homepage": "http://www.freetype.org",
|
||||
"Version": "2.13.1",
|
||||
"DownloadLocation": "https://download.savannah.gnu.org/releases/freetype/freetype-2.13.1.tar.gz",
|
||||
"Version": "2.13.2",
|
||||
"DownloadLocation": "https://download.savannah.gnu.org/releases/freetype/freetype-2.13.2.tar.gz",
|
||||
|
||||
"License": "Freetype Project License or GNU General Public License v2.0 only",
|
||||
"LicenseId": "FTL OR GPL-2.0-only",
|
||||
|
6
src/3rdparty/freetype/src/autofit/afcjk.c
vendored
6
src/3rdparty/freetype/src/autofit/afcjk.c
vendored
@ -1634,7 +1634,7 @@
|
||||
|
||||
stem_edge->pos = base_edge->pos + fitted_width;
|
||||
|
||||
FT_TRACE5(( " CJKLINK: edge %ld @%d (opos=%.2f) linked to %.2f,"
|
||||
FT_TRACE5(( " CJKLINK: edge %td @%d (opos=%.2f) linked to %.2f,"
|
||||
" dist was %.2f, now %.2f\n",
|
||||
stem_edge - hints->axis[dim].edges, stem_edge->fpos,
|
||||
(double)stem_edge->opos / 64,
|
||||
@ -1858,7 +1858,7 @@
|
||||
continue;
|
||||
|
||||
#ifdef FT_DEBUG_LEVEL_TRACE
|
||||
FT_TRACE5(( " CJKBLUE: edge %ld @%d (opos=%.2f) snapped to %.2f,"
|
||||
FT_TRACE5(( " CJKBLUE: edge %td @%d (opos=%.2f) snapped to %.2f,"
|
||||
" was %.2f\n",
|
||||
edge1 - edges, edge1->fpos, (double)edge1->opos / 64,
|
||||
(double)blue->fit / 64, (double)edge1->pos / 64 ));
|
||||
@ -1922,7 +1922,7 @@
|
||||
/* this should not happen, but it's better to be safe */
|
||||
if ( edge2->blue_edge )
|
||||
{
|
||||
FT_TRACE5(( "ASSERTION FAILED for edge %ld\n", edge2-edges ));
|
||||
FT_TRACE5(( "ASSERTION FAILED for edge %td\n", edge2 - edges ));
|
||||
|
||||
af_cjk_align_linked_edge( hints, dim, edge2, edge );
|
||||
edge->flags |= AF_EDGE_DONE;
|
||||
|
38
src/3rdparty/freetype/src/autofit/aflatin.c
vendored
38
src/3rdparty/freetype/src/autofit/aflatin.c
vendored
@ -1022,7 +1022,7 @@
|
||||
{
|
||||
*a = *b;
|
||||
FT_TRACE5(( "blue zone overlap:"
|
||||
" adjusting %s %ld to %ld\n",
|
||||
" adjusting %s %td to %ld\n",
|
||||
a_is_top ? "overshoot" : "reference",
|
||||
blue_sorted[i] - axis->blues,
|
||||
*a ));
|
||||
@ -2960,7 +2960,7 @@
|
||||
|
||||
stem_edge->pos = base_edge->pos + fitted_width;
|
||||
|
||||
FT_TRACE5(( " LINK: edge %ld (opos=%.2f) linked to %.2f,"
|
||||
FT_TRACE5(( " LINK: edge %td (opos=%.2f) linked to %.2f,"
|
||||
" dist was %.2f, now %.2f\n",
|
||||
stem_edge - hints->axis[dim].edges,
|
||||
(double)stem_edge->opos / 64, (double)stem_edge->pos / 64,
|
||||
@ -3085,13 +3085,13 @@
|
||||
|
||||
#ifdef FT_DEBUG_LEVEL_TRACE
|
||||
if ( !anchor )
|
||||
FT_TRACE5(( " BLUE_ANCHOR: edge %ld (opos=%.2f) snapped to %.2f,"
|
||||
" was %.2f (anchor=edge %ld)\n",
|
||||
FT_TRACE5(( " BLUE_ANCHOR: edge %td (opos=%.2f) snapped to %.2f,"
|
||||
" was %.2f (anchor=edge %td)\n",
|
||||
edge1 - edges,
|
||||
(double)edge1->opos / 64, (double)blue->fit / 64,
|
||||
(double)edge1->pos / 64, edge - edges ));
|
||||
else
|
||||
FT_TRACE5(( " BLUE: edge %ld (opos=%.2f) snapped to %.2f,"
|
||||
FT_TRACE5(( " BLUE: edge %td (opos=%.2f) snapped to %.2f,"
|
||||
" was %.2f\n",
|
||||
edge1 - edges,
|
||||
(double)edge1->opos / 64, (double)blue->fit / 64,
|
||||
@ -3141,7 +3141,7 @@
|
||||
/* this should not happen, but it's better to be safe */
|
||||
if ( edge2->blue_edge )
|
||||
{
|
||||
FT_TRACE5(( " ASSERTION FAILED for edge %ld\n", edge2 - edges ));
|
||||
FT_TRACE5(( " ASSERTION FAILED for edge %td\n", edge2 - edges ));
|
||||
|
||||
af_latin_align_linked_edge( hints, dim, edge2, edge );
|
||||
edge->flags |= AF_EDGE_DONE;
|
||||
@ -3209,7 +3209,7 @@
|
||||
anchor = edge;
|
||||
edge->flags |= AF_EDGE_DONE;
|
||||
|
||||
FT_TRACE5(( " ANCHOR: edge %ld (opos=%.2f) and %ld (opos=%.2f)"
|
||||
FT_TRACE5(( " ANCHOR: edge %td (opos=%.2f) and %td (opos=%.2f)"
|
||||
" snapped to %.2f and %.2f\n",
|
||||
edge - edges, (double)edge->opos / 64,
|
||||
edge2 - edges, (double)edge2->opos / 64,
|
||||
@ -3238,7 +3238,7 @@
|
||||
|
||||
if ( edge2->flags & AF_EDGE_DONE )
|
||||
{
|
||||
FT_TRACE5(( " ADJUST: edge %ld (pos=%.2f) moved to %.2f\n",
|
||||
FT_TRACE5(( " ADJUST: edge %td (pos=%.2f) moved to %.2f\n",
|
||||
edge - edges, (double)edge->pos / 64,
|
||||
(double)( edge2->pos - cur_len ) / 64 ));
|
||||
|
||||
@ -3279,7 +3279,7 @@
|
||||
edge->pos = cur_pos1 - cur_len / 2;
|
||||
edge2->pos = cur_pos1 + cur_len / 2;
|
||||
|
||||
FT_TRACE5(( " STEM: edge %ld (opos=%.2f) linked to %ld (opos=%.2f)"
|
||||
FT_TRACE5(( " STEM: edge %td (opos=%.2f) linked to %td (opos=%.2f)"
|
||||
" snapped to %.2f and %.2f\n",
|
||||
edge - edges, (double)edge->opos / 64,
|
||||
edge2 - edges, (double)edge2->opos / 64,
|
||||
@ -3310,7 +3310,7 @@
|
||||
edge->pos = ( delta1 < delta2 ) ? cur_pos1 : cur_pos2;
|
||||
edge2->pos = edge->pos + cur_len;
|
||||
|
||||
FT_TRACE5(( " STEM: edge %ld (opos=%.2f) linked to %ld (opos=%.2f)"
|
||||
FT_TRACE5(( " STEM: edge %td (opos=%.2f) linked to %td (opos=%.2f)"
|
||||
" snapped to %.2f and %.2f\n",
|
||||
edge - edges, (double)edge->opos / 64,
|
||||
edge2 - edges, (double)edge2->opos / 64,
|
||||
@ -3333,7 +3333,7 @@
|
||||
if ( edge->link && FT_ABS( edge->link->pos - edge[-1].pos ) > 16 )
|
||||
{
|
||||
#ifdef FT_DEBUG_LEVEL_TRACE
|
||||
FT_TRACE5(( " BOUND: edge %ld (pos=%.2f) moved to %.2f\n",
|
||||
FT_TRACE5(( " BOUND: edge %td (pos=%.2f) moved to %.2f\n",
|
||||
edge - edges,
|
||||
(double)edge->pos / 64,
|
||||
(double)edge[-1].pos / 64 ));
|
||||
@ -3435,7 +3435,7 @@
|
||||
if ( delta < 64 + 16 )
|
||||
{
|
||||
af_latin_align_serif_edge( hints, edge->serif, edge );
|
||||
FT_TRACE5(( " SERIF: edge %ld (opos=%.2f) serif to %ld (opos=%.2f)"
|
||||
FT_TRACE5(( " SERIF: edge %td (opos=%.2f) serif to %td (opos=%.2f)"
|
||||
" aligned to %.2f\n",
|
||||
edge - edges, (double)edge->opos / 64,
|
||||
edge->serif - edges, (double)edge->serif->opos / 64,
|
||||
@ -3445,9 +3445,9 @@
|
||||
{
|
||||
edge->pos = FT_PIX_ROUND( edge->opos );
|
||||
anchor = edge;
|
||||
FT_TRACE5(( " SERIF_ANCHOR: edge %ld (opos=%.2f)"
|
||||
FT_TRACE5(( " SERIF_ANCHOR: edge %td (opos=%.2f)"
|
||||
" snapped to %.2f\n",
|
||||
edge-edges,
|
||||
edge - edges,
|
||||
(double)edge->opos / 64, (double)edge->pos / 64 ));
|
||||
}
|
||||
else
|
||||
@ -3474,8 +3474,8 @@
|
||||
after->pos - before->pos,
|
||||
after->opos - before->opos );
|
||||
|
||||
FT_TRACE5(( " SERIF_LINK1: edge %ld (opos=%.2f) snapped to %.2f"
|
||||
" from %ld (opos=%.2f)\n",
|
||||
FT_TRACE5(( " SERIF_LINK1: edge %td (opos=%.2f) snapped to %.2f"
|
||||
" from %td (opos=%.2f)\n",
|
||||
edge - edges, (double)edge->opos / 64,
|
||||
(double)edge->pos / 64,
|
||||
before - edges, (double)before->opos / 64 ));
|
||||
@ -3484,7 +3484,7 @@
|
||||
{
|
||||
edge->pos = anchor->pos +
|
||||
( ( edge->opos - anchor->opos + 16 ) & ~31 );
|
||||
FT_TRACE5(( " SERIF_LINK2: edge %ld (opos=%.2f)"
|
||||
FT_TRACE5(( " SERIF_LINK2: edge %td (opos=%.2f)"
|
||||
" snapped to %.2f\n",
|
||||
edge - edges,
|
||||
(double)edge->opos / 64, (double)edge->pos / 64 ));
|
||||
@ -3505,7 +3505,7 @@
|
||||
if ( edge->link && FT_ABS( edge->link->pos - edge[-1].pos ) > 16 )
|
||||
{
|
||||
#ifdef FT_DEBUG_LEVEL_TRACE
|
||||
FT_TRACE5(( " BOUND: edge %ld (pos=%.2f) moved to %.2f\n",
|
||||
FT_TRACE5(( " BOUND: edge %td (pos=%.2f) moved to %.2f\n",
|
||||
edge - edges,
|
||||
(double)edge->pos / 64,
|
||||
(double)edge[-1].pos / 64 ));
|
||||
@ -3526,7 +3526,7 @@
|
||||
if ( edge->link && FT_ABS( edge->link->pos - edge[-1].pos ) > 16 )
|
||||
{
|
||||
#ifdef FT_DEBUG_LEVEL_TRACE
|
||||
FT_TRACE5(( " BOUND: edge %ld (pos=%.2f) moved to %.2f\n",
|
||||
FT_TRACE5(( " BOUND: edge %td (pos=%.2f) moved to %.2f\n",
|
||||
edge - edges,
|
||||
(double)edge->pos / 64,
|
||||
(double)edge[1].pos / 64 ));
|
||||
|
84
src/3rdparty/freetype/src/base/ftcalc.c
vendored
84
src/3rdparty/freetype/src/base/ftcalc.c
vendored
@ -749,65 +749,43 @@
|
||||
FT_BASE_DEF( FT_Bool )
|
||||
FT_Matrix_Check( const FT_Matrix* matrix )
|
||||
{
|
||||
FT_Matrix m;
|
||||
FT_Fixed val[4];
|
||||
FT_Fixed nonzero_minval, maxval;
|
||||
FT_Fixed temp1, temp2;
|
||||
FT_UInt i;
|
||||
FT_Fixed xx, xy, yx, yy;
|
||||
FT_Fixed val;
|
||||
FT_Int shift;
|
||||
FT_ULong temp1, temp2;
|
||||
|
||||
|
||||
if ( !matrix )
|
||||
return 0;
|
||||
|
||||
val[0] = FT_ABS( matrix->xx );
|
||||
val[1] = FT_ABS( matrix->xy );
|
||||
val[2] = FT_ABS( matrix->yx );
|
||||
val[3] = FT_ABS( matrix->yy );
|
||||
xx = matrix->xx;
|
||||
xy = matrix->xy;
|
||||
yx = matrix->yx;
|
||||
yy = matrix->yy;
|
||||
val = FT_ABS( xx ) | FT_ABS( xy ) | FT_ABS( yx ) | FT_ABS( yy );
|
||||
|
||||
/*
|
||||
* To avoid overflow, we ensure that each value is not larger than
|
||||
*
|
||||
* int(sqrt(2^31 / 4)) = 23170 ;
|
||||
*
|
||||
* we also check that no value becomes zero if we have to scale.
|
||||
*/
|
||||
|
||||
maxval = 0;
|
||||
nonzero_minval = FT_LONG_MAX;
|
||||
|
||||
for ( i = 0; i < 4; i++ )
|
||||
{
|
||||
if ( val[i] > maxval )
|
||||
maxval = val[i];
|
||||
if ( val[i] && val[i] < nonzero_minval )
|
||||
nonzero_minval = val[i];
|
||||
}
|
||||
|
||||
/* we only handle 32bit values */
|
||||
if ( maxval > 0x7FFFFFFFL )
|
||||
/* we only handle non-zero 32-bit values */
|
||||
if ( !val || val > 0x7FFFFFFFL )
|
||||
return 0;
|
||||
|
||||
if ( maxval > 23170 )
|
||||
/* Scale matrix to avoid the temp1 overflow, which is */
|
||||
/* more stringent than avoiding the temp2 overflow. */
|
||||
|
||||
shift = FT_MSB( val ) - 12;
|
||||
|
||||
if ( shift > 0 )
|
||||
{
|
||||
FT_Fixed scale = FT_DivFix( maxval, 23170 );
|
||||
|
||||
|
||||
if ( !FT_DivFix( nonzero_minval, scale ) )
|
||||
return 0; /* value range too large */
|
||||
|
||||
m.xx = FT_DivFix( matrix->xx, scale );
|
||||
m.xy = FT_DivFix( matrix->xy, scale );
|
||||
m.yx = FT_DivFix( matrix->yx, scale );
|
||||
m.yy = FT_DivFix( matrix->yy, scale );
|
||||
xx >>= shift;
|
||||
xy >>= shift;
|
||||
yx >>= shift;
|
||||
yy >>= shift;
|
||||
}
|
||||
else
|
||||
m = *matrix;
|
||||
|
||||
temp1 = FT_ABS( m.xx * m.yy - m.xy * m.yx );
|
||||
temp2 = m.xx * m.xx + m.xy * m.xy + m.yx * m.yx + m.yy * m.yy;
|
||||
temp1 = 32U * (FT_ULong)FT_ABS( xx * yy - xy * yx );
|
||||
temp2 = (FT_ULong)( xx * xx ) + (FT_ULong)( xy * xy ) +
|
||||
(FT_ULong)( yx * yx ) + (FT_ULong)( yy * yy );
|
||||
|
||||
if ( temp1 == 0 ||
|
||||
temp2 / temp1 > 50 )
|
||||
if ( temp1 <= temp2 )
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
@ -1092,9 +1070,6 @@
|
||||
{
|
||||
FT_UInt i;
|
||||
FT_Int64 temp;
|
||||
#ifndef FT_INT64
|
||||
FT_Int64 halfUnit;
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef FT_INT64
|
||||
@ -1139,13 +1114,10 @@
|
||||
FT_Add64( &temp, &multResult, &temp );
|
||||
}
|
||||
|
||||
/* Round value. */
|
||||
halfUnit.hi = 0;
|
||||
halfUnit.lo = 0x8000;
|
||||
FT_Add64( &temp, &halfUnit, &temp );
|
||||
/* Shift and round value. */
|
||||
return (FT_Int32)( ( ( temp.hi << 16 ) | ( temp.lo >> 16 ) )
|
||||
+ ( 1 & ( temp.lo >> 15 ) ) );
|
||||
|
||||
return (FT_Int32)( ( (FT_Int32)( temp.hi & 0xFFFF ) << 16 ) |
|
||||
( temp.lo >> 16 ) );
|
||||
|
||||
#endif /* !FT_INT64 */
|
||||
|
||||
|
3
src/3rdparty/freetype/src/base/ftobjs.c
vendored
3
src/3rdparty/freetype/src/base/ftobjs.c
vendored
@ -1747,7 +1747,8 @@
|
||||
FT_Memory memory = library->memory;
|
||||
|
||||
|
||||
args.flags = 0;
|
||||
args.driver = NULL;
|
||||
args.flags = 0;
|
||||
|
||||
if ( driver_name )
|
||||
{
|
||||
|
8
src/3rdparty/freetype/src/base/ftstream.c
vendored
8
src/3rdparty/freetype/src/base/ftstream.c
vendored
@ -141,7 +141,9 @@
|
||||
if ( read_bytes > count )
|
||||
read_bytes = count;
|
||||
|
||||
FT_MEM_COPY( buffer, stream->base + pos, read_bytes );
|
||||
/* Allow "reading" zero bytes without UB even if buffer is NULL */
|
||||
if ( count )
|
||||
FT_MEM_COPY( buffer, stream->base + pos, read_bytes );
|
||||
}
|
||||
|
||||
stream->pos = pos + read_bytes;
|
||||
@ -178,7 +180,9 @@
|
||||
if ( read_bytes > count )
|
||||
read_bytes = count;
|
||||
|
||||
FT_MEM_COPY( buffer, stream->base + stream->pos, read_bytes );
|
||||
/* Allow "reading" zero bytes without UB even if buffer is NULL */
|
||||
if ( count )
|
||||
FT_MEM_COPY( buffer, stream->base + stream->pos, read_bytes );
|
||||
}
|
||||
|
||||
stream->pos += read_bytes;
|
||||
|
4
src/3rdparty/freetype/src/base/ftver.rc
vendored
4
src/3rdparty/freetype/src/base/ftver.rc
vendored
@ -18,8 +18,8 @@
|
||||
|
||||
#include<windows.h>
|
||||
|
||||
#define FT_VERSION 2,13,1,0
|
||||
#define FT_VERSION_STR "2.13.1"
|
||||
#define FT_VERSION 2,13,2,0
|
||||
#define FT_VERSION_STR "2.13.2"
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION FT_VERSION
|
||||
|
9
src/3rdparty/freetype/src/cff/cffload.c
vendored
9
src/3rdparty/freetype/src/cff/cffload.c
vendored
@ -1361,14 +1361,15 @@
|
||||
for ( i = 0; i < numBlends; i++ )
|
||||
{
|
||||
const FT_Int32* weight = &blend->BV[1];
|
||||
FT_UInt32 sum;
|
||||
FT_Fixed sum;
|
||||
|
||||
|
||||
/* convert inputs to 16.16 fixed-point */
|
||||
sum = cff_parse_num( parser, &parser->stack[i + base] ) * 0x10000;
|
||||
/* convert inputs to 16.16 fixed point */
|
||||
sum = cff_parse_fixed( parser, &parser->stack[i + base] );
|
||||
|
||||
for ( j = 1; j < blend->lenBV; j++ )
|
||||
sum += cff_parse_num( parser, &parser->stack[delta++] ) * *weight++;
|
||||
sum += FT_MulFix( cff_parse_fixed( parser, &parser->stack[delta++] ),
|
||||
*weight++ );
|
||||
|
||||
/* point parser stack to new value on blend_stack */
|
||||
parser->stack[i + base] = subFont->blend_top;
|
||||
|
22
src/3rdparty/freetype/src/cff/cffparse.c
vendored
22
src/3rdparty/freetype/src/cff/cffparse.c
vendored
@ -499,6 +499,24 @@
|
||||
{
|
||||
if ( **d == 30 )
|
||||
return cff_parse_real( *d, parser->limit, scaling, NULL );
|
||||
else if ( **d == 255 )
|
||||
{
|
||||
FT_Fixed val = ( ( ( (FT_UInt32)*( d[0] + 1 ) << 24 ) |
|
||||
( (FT_UInt32)*( d[0] + 2 ) << 16 ) |
|
||||
( (FT_UInt32)*( d[0] + 3 ) << 8 ) |
|
||||
(FT_UInt32)*( d[0] + 4 ) ) );
|
||||
|
||||
if ( scaling )
|
||||
{
|
||||
if ( FT_ABS( val ) > power_ten_limits[scaling] )
|
||||
{
|
||||
FT_TRACE4(( "!!!OVERFLOW:!!!" ));
|
||||
return val > 0 ? 0x7FFFFFFFL : -0x7FFFFFFFL;
|
||||
}
|
||||
val *= power_tens[scaling];
|
||||
}
|
||||
return val;
|
||||
}
|
||||
else
|
||||
{
|
||||
FT_Long val = cff_parse_integer( *d, parser->limit );
|
||||
@ -506,7 +524,7 @@
|
||||
|
||||
if ( scaling )
|
||||
{
|
||||
if ( FT_ABS( val ) > power_ten_limits[scaling] )
|
||||
if ( ( FT_ABS( val ) << 16 ) > power_ten_limits[scaling] )
|
||||
{
|
||||
val = val > 0 ? 0x7FFFFFFFL : -0x7FFFFFFFL;
|
||||
goto Overflow;
|
||||
@ -536,7 +554,7 @@
|
||||
|
||||
|
||||
/* read a floating point number, either integer or real */
|
||||
static FT_Fixed
|
||||
FT_LOCAL_DEF( FT_Fixed )
|
||||
cff_parse_fixed( CFF_Parser parser,
|
||||
FT_Byte** d )
|
||||
{
|
||||
|
4
src/3rdparty/freetype/src/cff/cffparse.h
vendored
4
src/3rdparty/freetype/src/cff/cffparse.h
vendored
@ -76,6 +76,10 @@ FT_BEGIN_HEADER
|
||||
cff_parse_num( CFF_Parser parser,
|
||||
FT_Byte** d );
|
||||
|
||||
FT_LOCAL( FT_Fixed )
|
||||
cff_parse_fixed( CFF_Parser parser,
|
||||
FT_Byte** d );
|
||||
|
||||
FT_LOCAL( FT_Error )
|
||||
cff_parser_init( CFF_Parser parser,
|
||||
FT_UInt code,
|
||||
|
644
src/3rdparty/freetype/src/gzip/infback.c
vendored
644
src/3rdparty/freetype/src/gzip/infback.c
vendored
@ -1,644 +0,0 @@
|
||||
/* infback.c -- inflate using a call-back interface
|
||||
* Copyright (C) 1995-2022 Mark Adler
|
||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||
*/
|
||||
|
||||
/*
|
||||
This code is largely copied from inflate.c. Normally either infback.o or
|
||||
inflate.o would be linked into an application--not both. The interface
|
||||
with inffast.c is retained so that optimized assembler-coded versions of
|
||||
inflate_fast() can be used with either inflate.c or infback.c.
|
||||
*/
|
||||
|
||||
#include "zutil.h"
|
||||
#include "inftrees.h"
|
||||
#include "inflate.h"
|
||||
#include "inffast.h"
|
||||
|
||||
/* function prototypes */
|
||||
local void fixedtables OF((struct inflate_state FAR *state));
|
||||
|
||||
/*
|
||||
strm provides memory allocation functions in zalloc and zfree, or
|
||||
Z_NULL to use the library memory allocation functions.
|
||||
|
||||
windowBits is in the range 8..15, and window is a user-supplied
|
||||
window and output buffer that is 2**windowBits bytes.
|
||||
*/
|
||||
int ZEXPORT inflateBackInit_(
|
||||
z_streamp strm,
|
||||
int windowBits,
|
||||
unsigned char FAR *window,
|
||||
const char *version,
|
||||
int stream_size)
|
||||
{
|
||||
struct inflate_state FAR *state;
|
||||
|
||||
if (version == Z_NULL || version[0] != ZLIB_VERSION[0] ||
|
||||
stream_size != (int)(sizeof(z_stream)))
|
||||
return Z_VERSION_ERROR;
|
||||
if (strm == Z_NULL || window == Z_NULL ||
|
||||
windowBits < 8 || windowBits > 15)
|
||||
return Z_STREAM_ERROR;
|
||||
strm->msg = Z_NULL; /* in case we return an error */
|
||||
if (strm->zalloc == (alloc_func)0) {
|
||||
#ifdef Z_SOLO
|
||||
return Z_STREAM_ERROR;
|
||||
#else
|
||||
strm->zalloc = zcalloc;
|
||||
strm->opaque = (voidpf)0;
|
||||
#endif
|
||||
}
|
||||
if (strm->zfree == (free_func)0)
|
||||
#ifdef Z_SOLO
|
||||
return Z_STREAM_ERROR;
|
||||
#else
|
||||
strm->zfree = zcfree;
|
||||
#endif
|
||||
state = (struct inflate_state FAR *)ZALLOC(strm, 1,
|
||||
sizeof(struct inflate_state));
|
||||
if (state == Z_NULL) return Z_MEM_ERROR;
|
||||
Tracev((stderr, "inflate: allocated\n"));
|
||||
strm->state = (struct internal_state FAR *)state;
|
||||
state->dmax = 32768U;
|
||||
state->wbits = (uInt)windowBits;
|
||||
state->wsize = 1U << windowBits;
|
||||
state->window = window;
|
||||
state->wnext = 0;
|
||||
state->whave = 0;
|
||||
state->sane = 1;
|
||||
return Z_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
Return state with length and distance decoding tables and index sizes set to
|
||||
fixed code decoding. Normally this returns fixed tables from inffixed.h.
|
||||
If BUILDFIXED is defined, then instead this routine builds the tables the
|
||||
first time it's called, and returns those tables the first time and
|
||||
thereafter. This reduces the size of the code by about 2K bytes, in
|
||||
exchange for a little execution time. However, BUILDFIXED should not be
|
||||
used for threaded applications, since the rewriting of the tables and virgin
|
||||
may not be thread-safe.
|
||||
*/
|
||||
local void fixedtables(
|
||||
struct inflate_state FAR *state)
|
||||
{
|
||||
#ifdef BUILDFIXED
|
||||
static int virgin = 1;
|
||||
static code *lenfix, *distfix;
|
||||
static code fixed[544];
|
||||
|
||||
/* build fixed huffman tables if first call (may not be thread safe) */
|
||||
if (virgin) {
|
||||
unsigned sym, bits;
|
||||
static code *next;
|
||||
|
||||
/* literal/length table */
|
||||
sym = 0;
|
||||
while (sym < 144) state->lens[sym++] = 8;
|
||||
while (sym < 256) state->lens[sym++] = 9;
|
||||
while (sym < 280) state->lens[sym++] = 7;
|
||||
while (sym < 288) state->lens[sym++] = 8;
|
||||
next = fixed;
|
||||
lenfix = next;
|
||||
bits = 9;
|
||||
inflate_table(LENS, state->lens, 288, &(next), &(bits), state->work);
|
||||
|
||||
/* distance table */
|
||||
sym = 0;
|
||||
while (sym < 32) state->lens[sym++] = 5;
|
||||
distfix = next;
|
||||
bits = 5;
|
||||
inflate_table(DISTS, state->lens, 32, &(next), &(bits), state->work);
|
||||
|
||||
/* do this just once */
|
||||
virgin = 0;
|
||||
}
|
||||
#else /* !BUILDFIXED */
|
||||
# include "inffixed.h"
|
||||
#endif /* BUILDFIXED */
|
||||
state->lencode = lenfix;
|
||||
state->lenbits = 9;
|
||||
state->distcode = distfix;
|
||||
state->distbits = 5;
|
||||
}
|
||||
|
||||
/* Macros for inflateBack(): */
|
||||
|
||||
/* Load returned state from inflate_fast() */
|
||||
#define LOAD() \
|
||||
do { \
|
||||
put = strm->next_out; \
|
||||
left = strm->avail_out; \
|
||||
next = strm->next_in; \
|
||||
have = strm->avail_in; \
|
||||
hold = state->hold; \
|
||||
bits = state->bits; \
|
||||
} while (0)
|
||||
|
||||
/* Set state from registers for inflate_fast() */
|
||||
#define RESTORE() \
|
||||
do { \
|
||||
strm->next_out = put; \
|
||||
strm->avail_out = left; \
|
||||
strm->next_in = next; \
|
||||
strm->avail_in = have; \
|
||||
state->hold = hold; \
|
||||
state->bits = bits; \
|
||||
} while (0)
|
||||
|
||||
/* Clear the input bit accumulator */
|
||||
#define INITBITS() \
|
||||
do { \
|
||||
hold = 0; \
|
||||
bits = 0; \
|
||||
} while (0)
|
||||
|
||||
/* Assure that some input is available. If input is requested, but denied,
|
||||
then return a Z_BUF_ERROR from inflateBack(). */
|
||||
#define PULL() \
|
||||
do { \
|
||||
if (have == 0) { \
|
||||
have = in(in_desc, &next); \
|
||||
if (have == 0) { \
|
||||
next = Z_NULL; \
|
||||
ret = Z_BUF_ERROR; \
|
||||
goto inf_leave; \
|
||||
} \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
/* Get a byte of input into the bit accumulator, or return from inflateBack()
|
||||
with an error if there is no input available. */
|
||||
#define PULLBYTE() \
|
||||
do { \
|
||||
PULL(); \
|
||||
have--; \
|
||||
hold += (unsigned long)(*next++) << bits; \
|
||||
bits += 8; \
|
||||
} while (0)
|
||||
|
||||
/* Assure that there are at least n bits in the bit accumulator. If there is
|
||||
not enough available input to do that, then return from inflateBack() with
|
||||
an error. */
|
||||
#define NEEDBITS(n) \
|
||||
do { \
|
||||
while (bits < (unsigned)(n)) \
|
||||
PULLBYTE(); \
|
||||
} while (0)
|
||||
|
||||
/* Return the low n bits of the bit accumulator (n < 16) */
|
||||
#define BITS(n) \
|
||||
((unsigned)hold & ((1U << (n)) - 1))
|
||||
|
||||
/* Remove n bits from the bit accumulator */
|
||||
#define DROPBITS(n) \
|
||||
do { \
|
||||
hold >>= (n); \
|
||||
bits -= (unsigned)(n); \
|
||||
} while (0)
|
||||
|
||||
/* Remove zero to seven bits as needed to go to a byte boundary */
|
||||
#define BYTEBITS() \
|
||||
do { \
|
||||
hold >>= bits & 7; \
|
||||
bits -= bits & 7; \
|
||||
} while (0)
|
||||
|
||||
/* Assure that some output space is available, by writing out the window
|
||||
if it's full. If the write fails, return from inflateBack() with a
|
||||
Z_BUF_ERROR. */
|
||||
#define ROOM() \
|
||||
do { \
|
||||
if (left == 0) { \
|
||||
put = state->window; \
|
||||
left = state->wsize; \
|
||||
state->whave = left; \
|
||||
if (out(out_desc, put, left)) { \
|
||||
ret = Z_BUF_ERROR; \
|
||||
goto inf_leave; \
|
||||
} \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
/*
|
||||
strm provides the memory allocation functions and window buffer on input,
|
||||
and provides information on the unused input on return. For Z_DATA_ERROR
|
||||
returns, strm will also provide an error message.
|
||||
|
||||
in() and out() are the call-back input and output functions. When
|
||||
inflateBack() needs more input, it calls in(). When inflateBack() has
|
||||
filled the window with output, or when it completes with data in the
|
||||
window, it calls out() to write out the data. The application must not
|
||||
change the provided input until in() is called again or inflateBack()
|
||||
returns. The application must not change the window/output buffer until
|
||||
inflateBack() returns.
|
||||
|
||||
in() and out() are called with a descriptor parameter provided in the
|
||||
inflateBack() call. This parameter can be a structure that provides the
|
||||
information required to do the read or write, as well as accumulated
|
||||
information on the input and output such as totals and check values.
|
||||
|
||||
in() should return zero on failure. out() should return non-zero on
|
||||
failure. If either in() or out() fails, than inflateBack() returns a
|
||||
Z_BUF_ERROR. strm->next_in can be checked for Z_NULL to see whether it
|
||||
was in() or out() that caused in the error. Otherwise, inflateBack()
|
||||
returns Z_STREAM_END on success, Z_DATA_ERROR for an deflate format
|
||||
error, or Z_MEM_ERROR if it could not allocate memory for the state.
|
||||
inflateBack() can also return Z_STREAM_ERROR if the input parameters
|
||||
are not correct, i.e. strm is Z_NULL or the state was not initialized.
|
||||
*/
|
||||
int ZEXPORT inflateBack(
|
||||
z_streamp strm,
|
||||
in_func in,
|
||||
void FAR *in_desc,
|
||||
out_func out,
|
||||
void FAR *out_desc)
|
||||
{
|
||||
struct inflate_state FAR *state;
|
||||
z_const unsigned char FAR *next; /* next input */
|
||||
unsigned char FAR *put; /* next output */
|
||||
unsigned have, left; /* available input and output */
|
||||
unsigned long hold; /* bit buffer */
|
||||
unsigned bits; /* bits in bit buffer */
|
||||
unsigned copy; /* number of stored or match bytes to copy */
|
||||
unsigned char FAR *from; /* where to copy match bytes from */
|
||||
code here; /* current decoding table entry */
|
||||
code last; /* parent table entry */
|
||||
unsigned len; /* length to copy for repeats, bits to drop */
|
||||
int ret; /* return code */
|
||||
static const unsigned short order[19] = /* permutation of code lengths */
|
||||
{16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15};
|
||||
|
||||
/* Check that the strm exists and that the state was initialized */
|
||||
if (strm == Z_NULL || strm->state == Z_NULL)
|
||||
return Z_STREAM_ERROR;
|
||||
state = (struct inflate_state FAR *)strm->state;
|
||||
|
||||
/* Reset the state */
|
||||
strm->msg = Z_NULL;
|
||||
state->mode = TYPE;
|
||||
state->last = 0;
|
||||
state->whave = 0;
|
||||
next = strm->next_in;
|
||||
have = next != Z_NULL ? strm->avail_in : 0;
|
||||
hold = 0;
|
||||
bits = 0;
|
||||
put = state->window;
|
||||
left = state->wsize;
|
||||
|
||||
/* Inflate until end of block marked as last */
|
||||
for (;;)
|
||||
switch (state->mode) {
|
||||
case TYPE:
|
||||
/* determine and dispatch block type */
|
||||
if (state->last) {
|
||||
BYTEBITS();
|
||||
state->mode = DONE;
|
||||
break;
|
||||
}
|
||||
NEEDBITS(3);
|
||||
state->last = BITS(1);
|
||||
DROPBITS(1);
|
||||
switch (BITS(2)) {
|
||||
case 0: /* stored block */
|
||||
Tracev((stderr, "inflate: stored block%s\n",
|
||||
state->last ? " (last)" : ""));
|
||||
state->mode = STORED;
|
||||
break;
|
||||
case 1: /* fixed block */
|
||||
fixedtables(state);
|
||||
Tracev((stderr, "inflate: fixed codes block%s\n",
|
||||
state->last ? " (last)" : ""));
|
||||
state->mode = LEN; /* decode codes */
|
||||
break;
|
||||
case 2: /* dynamic block */
|
||||
Tracev((stderr, "inflate: dynamic codes block%s\n",
|
||||
state->last ? " (last)" : ""));
|
||||
state->mode = TABLE;
|
||||
break;
|
||||
case 3:
|
||||
strm->msg = (char *)"invalid block type";
|
||||
state->mode = BAD;
|
||||
}
|
||||
DROPBITS(2);
|
||||
break;
|
||||
|
||||
case STORED:
|
||||
/* get and verify stored block length */
|
||||
BYTEBITS(); /* go to byte boundary */
|
||||
NEEDBITS(32);
|
||||
if ((hold & 0xffff) != ((hold >> 16) ^ 0xffff)) {
|
||||
strm->msg = (char *)"invalid stored block lengths";
|
||||
state->mode = BAD;
|
||||
break;
|
||||
}
|
||||
state->length = (unsigned)hold & 0xffff;
|
||||
Tracev((stderr, "inflate: stored length %u\n",
|
||||
state->length));
|
||||
INITBITS();
|
||||
|
||||
/* copy stored block from input to output */
|
||||
while (state->length != 0) {
|
||||
copy = state->length;
|
||||
PULL();
|
||||
ROOM();
|
||||
if (copy > have) copy = have;
|
||||
if (copy > left) copy = left;
|
||||
zmemcpy(put, next, copy);
|
||||
have -= copy;
|
||||
next += copy;
|
||||
left -= copy;
|
||||
put += copy;
|
||||
state->length -= copy;
|
||||
}
|
||||
Tracev((stderr, "inflate: stored end\n"));
|
||||
state->mode = TYPE;
|
||||
break;
|
||||
|
||||
case TABLE:
|
||||
/* get dynamic table entries descriptor */
|
||||
NEEDBITS(14);
|
||||
state->nlen = BITS(5) + 257;
|
||||
DROPBITS(5);
|
||||
state->ndist = BITS(5) + 1;
|
||||
DROPBITS(5);
|
||||
state->ncode = BITS(4) + 4;
|
||||
DROPBITS(4);
|
||||
#ifndef PKZIP_BUG_WORKAROUND
|
||||
if (state->nlen > 286 || state->ndist > 30) {
|
||||
strm->msg = (char *)"too many length or distance symbols";
|
||||
state->mode = BAD;
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
Tracev((stderr, "inflate: table sizes ok\n"));
|
||||
|
||||
/* get code length code lengths (not a typo) */
|
||||
state->have = 0;
|
||||
while (state->have < state->ncode) {
|
||||
NEEDBITS(3);
|
||||
state->lens[order[state->have++]] = (unsigned short)BITS(3);
|
||||
DROPBITS(3);
|
||||
}
|
||||
while (state->have < 19)
|
||||
state->lens[order[state->have++]] = 0;
|
||||
state->next = state->codes;
|
||||
state->lencode = (code const FAR *)(state->next);
|
||||
state->lenbits = 7;
|
||||
ret = inflate_table(CODES, state->lens, 19, &(state->next),
|
||||
&(state->lenbits), state->work);
|
||||
if (ret) {
|
||||
strm->msg = (char *)"invalid code lengths set";
|
||||
state->mode = BAD;
|
||||
break;
|
||||
}
|
||||
Tracev((stderr, "inflate: code lengths ok\n"));
|
||||
|
||||
/* get length and distance code code lengths */
|
||||
state->have = 0;
|
||||
while (state->have < state->nlen + state->ndist) {
|
||||
for (;;) {
|
||||
here = state->lencode[BITS(state->lenbits)];
|
||||
if ((unsigned)(here.bits) <= bits) break;
|
||||
PULLBYTE();
|
||||
}
|
||||
if (here.val < 16) {
|
||||
DROPBITS(here.bits);
|
||||
state->lens[state->have++] = here.val;
|
||||
}
|
||||
else {
|
||||
if (here.val == 16) {
|
||||
NEEDBITS(here.bits + 2);
|
||||
DROPBITS(here.bits);
|
||||
if (state->have == 0) {
|
||||
strm->msg = (char *)"invalid bit length repeat";
|
||||
state->mode = BAD;
|
||||
break;
|
||||
}
|
||||
len = (unsigned)(state->lens[state->have - 1]);
|
||||
copy = 3 + BITS(2);
|
||||
DROPBITS(2);
|
||||
}
|
||||
else if (here.val == 17) {
|
||||
NEEDBITS(here.bits + 3);
|
||||
DROPBITS(here.bits);
|
||||
len = 0;
|
||||
copy = 3 + BITS(3);
|
||||
DROPBITS(3);
|
||||
}
|
||||
else {
|
||||
NEEDBITS(here.bits + 7);
|
||||
DROPBITS(here.bits);
|
||||
len = 0;
|
||||
copy = 11 + BITS(7);
|
||||
DROPBITS(7);
|
||||
}
|
||||
if (state->have + copy > state->nlen + state->ndist) {
|
||||
strm->msg = (char *)"invalid bit length repeat";
|
||||
state->mode = BAD;
|
||||
break;
|
||||
}
|
||||
while (copy--)
|
||||
state->lens[state->have++] = (unsigned short)len;
|
||||
}
|
||||
}
|
||||
|
||||
/* handle error breaks in while */
|
||||
if (state->mode == BAD) break;
|
||||
|
||||
/* check for end-of-block code (better have one) */
|
||||
if (state->lens[256] == 0) {
|
||||
strm->msg = (char *)"invalid code -- missing end-of-block";
|
||||
state->mode = BAD;
|
||||
break;
|
||||
}
|
||||
|
||||
/* build code tables -- note: do not change the lenbits or distbits
|
||||
values here (9 and 6) without reading the comments in inftrees.h
|
||||
concerning the ENOUGH constants, which depend on those values */
|
||||
state->next = state->codes;
|
||||
state->lencode = (code const FAR *)(state->next);
|
||||
state->lenbits = 9;
|
||||
ret = inflate_table(LENS, state->lens, state->nlen, &(state->next),
|
||||
&(state->lenbits), state->work);
|
||||
if (ret) {
|
||||
strm->msg = (char *)"invalid literal/lengths set";
|
||||
state->mode = BAD;
|
||||
break;
|
||||
}
|
||||
state->distcode = (code const FAR *)(state->next);
|
||||
state->distbits = 6;
|
||||
ret = inflate_table(DISTS, state->lens + state->nlen, state->ndist,
|
||||
&(state->next), &(state->distbits), state->work);
|
||||
if (ret) {
|
||||
strm->msg = (char *)"invalid distances set";
|
||||
state->mode = BAD;
|
||||
break;
|
||||
}
|
||||
Tracev((stderr, "inflate: codes ok\n"));
|
||||
state->mode = LEN;
|
||||
/* fallthrough */
|
||||
|
||||
case LEN:
|
||||
/* use inflate_fast() if we have enough input and output */
|
||||
if (have >= 6 && left >= 258) {
|
||||
RESTORE();
|
||||
if (state->whave < state->wsize)
|
||||
state->whave = state->wsize - left;
|
||||
inflate_fast(strm, state->wsize);
|
||||
LOAD();
|
||||
break;
|
||||
}
|
||||
|
||||
/* get a literal, length, or end-of-block code */
|
||||
for (;;) {
|
||||
here = state->lencode[BITS(state->lenbits)];
|
||||
if ((unsigned)(here.bits) <= bits) break;
|
||||
PULLBYTE();
|
||||
}
|
||||
if (here.op && (here.op & 0xf0) == 0) {
|
||||
last = here;
|
||||
for (;;) {
|
||||
here = state->lencode[last.val +
|
||||
(BITS(last.bits + last.op) >> last.bits)];
|
||||
if ((unsigned)(last.bits + here.bits) <= bits) break;
|
||||
PULLBYTE();
|
||||
}
|
||||
DROPBITS(last.bits);
|
||||
}
|
||||
DROPBITS(here.bits);
|
||||
state->length = (unsigned)here.val;
|
||||
|
||||
/* process literal */
|
||||
if (here.op == 0) {
|
||||
Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?
|
||||
"inflate: literal '%c'\n" :
|
||||
"inflate: literal 0x%02x\n", here.val));
|
||||
ROOM();
|
||||
*put++ = (unsigned char)(state->length);
|
||||
left--;
|
||||
state->mode = LEN;
|
||||
break;
|
||||
}
|
||||
|
||||
/* process end of block */
|
||||
if (here.op & 32) {
|
||||
Tracevv((stderr, "inflate: end of block\n"));
|
||||
state->mode = TYPE;
|
||||
break;
|
||||
}
|
||||
|
||||
/* invalid code */
|
||||
if (here.op & 64) {
|
||||
strm->msg = (char *)"invalid literal/length code";
|
||||
state->mode = BAD;
|
||||
break;
|
||||
}
|
||||
|
||||
/* length code -- get extra bits, if any */
|
||||
state->extra = (unsigned)(here.op) & 15;
|
||||
if (state->extra != 0) {
|
||||
NEEDBITS(state->extra);
|
||||
state->length += BITS(state->extra);
|
||||
DROPBITS(state->extra);
|
||||
}
|
||||
Tracevv((stderr, "inflate: length %u\n", state->length));
|
||||
|
||||
/* get distance code */
|
||||
for (;;) {
|
||||
here = state->distcode[BITS(state->distbits)];
|
||||
if ((unsigned)(here.bits) <= bits) break;
|
||||
PULLBYTE();
|
||||
}
|
||||
if ((here.op & 0xf0) == 0) {
|
||||
last = here;
|
||||
for (;;) {
|
||||
here = state->distcode[last.val +
|
||||
(BITS(last.bits + last.op) >> last.bits)];
|
||||
if ((unsigned)(last.bits + here.bits) <= bits) break;
|
||||
PULLBYTE();
|
||||
}
|
||||
DROPBITS(last.bits);
|
||||
}
|
||||
DROPBITS(here.bits);
|
||||
if (here.op & 64) {
|
||||
strm->msg = (char *)"invalid distance code";
|
||||
state->mode = BAD;
|
||||
break;
|
||||
}
|
||||
state->offset = (unsigned)here.val;
|
||||
|
||||
/* get distance extra bits, if any */
|
||||
state->extra = (unsigned)(here.op) & 15;
|
||||
if (state->extra != 0) {
|
||||
NEEDBITS(state->extra);
|
||||
state->offset += BITS(state->extra);
|
||||
DROPBITS(state->extra);
|
||||
}
|
||||
if (state->offset > state->wsize - (state->whave < state->wsize ?
|
||||
left : 0)) {
|
||||
strm->msg = (char *)"invalid distance too far back";
|
||||
state->mode = BAD;
|
||||
break;
|
||||
}
|
||||
Tracevv((stderr, "inflate: distance %u\n", state->offset));
|
||||
|
||||
/* copy match from window to output */
|
||||
do {
|
||||
ROOM();
|
||||
copy = state->wsize - state->offset;
|
||||
if (copy < left) {
|
||||
from = put + copy;
|
||||
copy = left - copy;
|
||||
}
|
||||
else {
|
||||
from = put - state->offset;
|
||||
copy = left;
|
||||
}
|
||||
if (copy > state->length) copy = state->length;
|
||||
state->length -= copy;
|
||||
left -= copy;
|
||||
do {
|
||||
*put++ = *from++;
|
||||
} while (--copy);
|
||||
} while (state->length != 0);
|
||||
break;
|
||||
|
||||
case DONE:
|
||||
/* inflate stream terminated properly */
|
||||
ret = Z_STREAM_END;
|
||||
goto inf_leave;
|
||||
|
||||
case BAD:
|
||||
ret = Z_DATA_ERROR;
|
||||
goto inf_leave;
|
||||
|
||||
default:
|
||||
/* can't happen, but makes compilers happy */
|
||||
ret = Z_STREAM_ERROR;
|
||||
goto inf_leave;
|
||||
}
|
||||
|
||||
/* Write leftover output and return unused input */
|
||||
inf_leave:
|
||||
if (left < state->wsize) {
|
||||
if (out(out_desc, state->window, state->wsize - left) &&
|
||||
ret == Z_STREAM_END)
|
||||
ret = Z_BUF_ERROR;
|
||||
}
|
||||
strm->next_in = next;
|
||||
strm->avail_in = have;
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ZEXPORT inflateBackEnd(
|
||||
z_streamp strm)
|
||||
{
|
||||
if (strm == Z_NULL || strm->state == Z_NULL || strm->zfree == (free_func)0)
|
||||
return Z_STREAM_ERROR;
|
||||
ZFREE(strm, strm->state);
|
||||
strm->state = Z_NULL;
|
||||
Tracev((stderr, "inflate: end\n"));
|
||||
return Z_OK;
|
||||
}
|
33
src/3rdparty/freetype/src/gzip/rules.mk
vendored
33
src/3rdparty/freetype/src/gzip/rules.mk
vendored
@ -36,24 +36,23 @@ endif
|
||||
#
|
||||
# All source and header files get loaded by `ftgzip.c' only if SYSTEM_ZLIB
|
||||
# is not defined (regardless whether we have a `single' or a `multi' build).
|
||||
# However, it doesn't harm if we add everything as a dependency
|
||||
# unconditionally.
|
||||
#
|
||||
GZIP_DRV_SRCS := $(GZIP_DIR)/adler32.c \
|
||||
$(GZIP_DIR)/crc32.c \
|
||||
$(GZIP_DIR)/crc32.h \
|
||||
$(GZIP_DIR)/ftzconf.h \
|
||||
$(GZIP_DIR)/inffast.c \
|
||||
$(GZIP_DIR)/inffast.h \
|
||||
$(GZIP_DIR)/inffixed.h \
|
||||
$(GZIP_DIR)/inflate.c \
|
||||
$(GZIP_DIR)/inflate.h \
|
||||
$(GZIP_DIR)/inftrees.c \
|
||||
$(GZIP_DIR)/inftrees.h \
|
||||
$(GZIP_DIR)/zlib.h \
|
||||
$(GZIP_DIR)/zutil.c \
|
||||
$(GZIP_DIR)/zutil.h
|
||||
|
||||
ifeq ($(SYSTEM_ZLIB),)
|
||||
GZIP_DRV_SRCS := $(GZIP_DIR)/adler32.c \
|
||||
$(GZIP_DIR)/crc32.c \
|
||||
$(GZIP_DIR)/crc32.h \
|
||||
$(GZIP_DIR)/ftzconf.h \
|
||||
$(GZIP_DIR)/inffast.c \
|
||||
$(GZIP_DIR)/inffast.h \
|
||||
$(GZIP_DIR)/inffixed.h \
|
||||
$(GZIP_DIR)/inflate.c \
|
||||
$(GZIP_DIR)/inflate.h \
|
||||
$(GZIP_DIR)/inftrees.c \
|
||||
$(GZIP_DIR)/inftrees.h \
|
||||
$(GZIP_DIR)/zlib.h \
|
||||
$(GZIP_DIR)/zutil.c \
|
||||
$(GZIP_DIR)/zutil.h
|
||||
endif
|
||||
|
||||
# gzip driver object(s)
|
||||
#
|
||||
|
6
src/3rdparty/freetype/src/psaux/cffdecode.c
vendored
6
src/3rdparty/freetype/src/psaux/cffdecode.c
vendored
@ -2153,7 +2153,7 @@
|
||||
decoder->locals_bias );
|
||||
|
||||
|
||||
FT_TRACE4(( " callsubr (idx %d, entering level %ld)\n",
|
||||
FT_TRACE4(( " callsubr (idx %d, entering level %td)\n",
|
||||
idx,
|
||||
zone - decoder->zones + 1 ));
|
||||
|
||||
@ -2197,7 +2197,7 @@
|
||||
decoder->globals_bias );
|
||||
|
||||
|
||||
FT_TRACE4(( " callgsubr (idx %d, entering level %ld)\n",
|
||||
FT_TRACE4(( " callgsubr (idx %d, entering level %td)\n",
|
||||
idx,
|
||||
zone - decoder->zones + 1 ));
|
||||
|
||||
@ -2236,7 +2236,7 @@
|
||||
break;
|
||||
|
||||
case cff_op_return:
|
||||
FT_TRACE4(( " return (leaving level %ld)\n",
|
||||
FT_TRACE4(( " return (leaving level %td)\n",
|
||||
decoder->zone - decoder->zones ));
|
||||
|
||||
if ( decoder->zone <= decoder->zones )
|
||||
|
2
src/3rdparty/freetype/src/psaux/pshints.c
vendored
2
src/3rdparty/freetype/src/psaux/pshints.c
vendored
@ -310,7 +310,7 @@
|
||||
CF2_Hint hint = &hintmap->edge[i];
|
||||
|
||||
|
||||
FT_TRACE6(( " %3ld %7.2f %7.2f %5d %s%s%s%s\n",
|
||||
FT_TRACE6(( " %3zu %7.2f %7.2f %5d %s%s%s%s\n",
|
||||
hint->index,
|
||||
hint->csCoord / 65536.0,
|
||||
hint->dsCoord / ( hint->scale * 1.0 ),
|
||||
|
4
src/3rdparty/freetype/src/psaux/t1decode.c
vendored
4
src/3rdparty/freetype/src/psaux/t1decode.c
vendored
@ -520,7 +520,7 @@
|
||||
#ifdef FT_DEBUG_LEVEL_TRACE
|
||||
if ( bol )
|
||||
{
|
||||
FT_TRACE5(( " (%ld)", decoder->top - decoder->stack ));
|
||||
FT_TRACE5(( " (%td)", decoder->top - decoder->stack ));
|
||||
bol = FALSE;
|
||||
}
|
||||
#endif
|
||||
@ -1165,7 +1165,7 @@
|
||||
if ( top - decoder->stack != num_args )
|
||||
FT_TRACE0(( "t1_decoder_parse_charstrings:"
|
||||
" too much operands on the stack"
|
||||
" (seen %ld, expected %d)\n",
|
||||
" (seen %td, expected %d)\n",
|
||||
top - decoder->stack, num_args ));
|
||||
break;
|
||||
}
|
||||
|
18
src/3rdparty/freetype/src/sfnt/sfwoff2.c
vendored
18
src/3rdparty/freetype/src/sfnt/sfwoff2.c
vendored
@ -36,6 +36,8 @@
|
||||
#undef FT_COMPONENT
|
||||
#define FT_COMPONENT sfwoff2
|
||||
|
||||
/* An arbitrary, heuristic size limit (67MByte) for expanded WOFF2 data. */
|
||||
#define MAX_SFNT_SIZE ( 1 << 26 )
|
||||
|
||||
#define READ_255USHORT( var ) FT_SET_ERROR( Read255UShort( stream, &var ) )
|
||||
|
||||
@ -2180,9 +2182,8 @@
|
||||
else
|
||||
sfnt_size = woff2.totalSfntSize;
|
||||
|
||||
/* Value 1<<26 = 67108864 is heuristic. */
|
||||
if (sfnt_size >= (1 << 26))
|
||||
sfnt_size = 1 << 26;
|
||||
if ( sfnt_size >= MAX_SFNT_SIZE )
|
||||
sfnt_size = MAX_SFNT_SIZE;
|
||||
|
||||
#ifdef FT_DEBUG_LEVEL_TRACE
|
||||
if ( sfnt_size != woff2.totalSfntSize )
|
||||
@ -2257,10 +2258,15 @@
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
if ( woff2.uncompressed_size > sfnt_size )
|
||||
/* We must not blindly trust `uncompressed_size` since its */
|
||||
/* value might be corrupted. If it is too large, reject the */
|
||||
/* font. In other words, we don't accept a WOFF2 font that */
|
||||
/* expands to something larger than MAX_SFNT_SIZE. If ever */
|
||||
/* necessary, this limit can be easily adjusted. */
|
||||
if ( woff2.uncompressed_size > MAX_SFNT_SIZE )
|
||||
{
|
||||
FT_ERROR(( "woff2_open_font: SFNT table lengths are too large.\n" ));
|
||||
error = FT_THROW( Invalid_Table );
|
||||
FT_ERROR(( "Uncompressed font too large.\n" ));
|
||||
error = FT_THROW( Array_Too_Large );
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
|
4
src/3rdparty/freetype/src/sfnt/ttcolr.c
vendored
4
src/3rdparty/freetype/src/sfnt/ttcolr.c
vendored
@ -229,7 +229,7 @@
|
||||
|
||||
base_glyphs_offset_v1 = FT_NEXT_ULONG( p );
|
||||
|
||||
if ( base_glyphs_offset_v1 + 4 >= table_size )
|
||||
if ( base_glyphs_offset_v1 >= table_size - 4 )
|
||||
goto InvalidTable;
|
||||
|
||||
p1 = (FT_Byte*)( table + base_glyphs_offset_v1 );
|
||||
@ -249,7 +249,7 @@
|
||||
|
||||
if ( layer_offset_v1 )
|
||||
{
|
||||
if ( layer_offset_v1 + 4 >= table_size )
|
||||
if ( layer_offset_v1 >= table_size - 4 )
|
||||
goto InvalidTable;
|
||||
|
||||
p1 = (FT_Byte*)( table + layer_offset_v1 );
|
||||
|
11
src/3rdparty/freetype/src/smooth/ftgrays.c
vendored
11
src/3rdparty/freetype/src/smooth/ftgrays.c
vendored
@ -1006,10 +1006,11 @@ typedef ptrdiff_t FT_PtrDist;
|
||||
*
|
||||
* For other cases, using binary splits is actually slightly faster.
|
||||
*/
|
||||
#if defined( __SSE2__ ) || \
|
||||
( defined( __x86_64__ ) && !defined( __VMS ) ) || \
|
||||
defined( _M_AMD64 ) || \
|
||||
( defined( _M_IX86_FP ) && _M_IX86_FP >= 2 )
|
||||
#if ( defined( __SSE2__ ) || \
|
||||
defined( __x86_64__ ) || \
|
||||
defined( _M_AMD64 ) || \
|
||||
( defined( _M_IX86_FP ) && _M_IX86_FP >= 2 ) ) && \
|
||||
!defined( __VMS )
|
||||
# define FT_SSE2 1
|
||||
#else
|
||||
# define FT_SSE2 0
|
||||
@ -1933,7 +1934,7 @@ typedef ptrdiff_t FT_PtrDist;
|
||||
if ( continued )
|
||||
FT_Trace_Enable();
|
||||
|
||||
FT_TRACE7(( "band [%d..%d]: %ld cell%s remaining/\n",
|
||||
FT_TRACE7(( "band [%d..%d]: %td cell%s remaining/\n",
|
||||
ras.min_ey,
|
||||
ras.max_ey,
|
||||
ras.cell_null - ras.cell_free,
|
||||
|
3
src/3rdparty/freetype/src/truetype/rules.mk
vendored
3
src/3rdparty/freetype/src/truetype/rules.mk
vendored
@ -33,8 +33,7 @@ TT_DRV_SRC := $(TT_DIR)/ttdriver.c \
|
||||
$(TT_DIR)/ttgxvar.c \
|
||||
$(TT_DIR)/ttinterp.c \
|
||||
$(TT_DIR)/ttobjs.c \
|
||||
$(TT_DIR)/ttpload.c \
|
||||
$(TT_DIR)/ttsubpix.c
|
||||
$(TT_DIR)/ttpload.c
|
||||
|
||||
# TrueType driver headers
|
||||
#
|
||||
|
@ -24,7 +24,6 @@
|
||||
#include "ttinterp.c"
|
||||
#include "ttobjs.c" /* object manager */
|
||||
#include "ttpload.c" /* tables loader */
|
||||
#include "ttsubpix.c"
|
||||
|
||||
|
||||
/* END */
|
||||
|
@ -100,11 +100,6 @@
|
||||
break;
|
||||
|
||||
case TT_INTERPRETER_VERSION_38:
|
||||
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
|
||||
driver->interpreter_version = TT_INTERPRETER_VERSION_38;
|
||||
break;
|
||||
#endif
|
||||
|
||||
case TT_INTERPRETER_VERSION_40:
|
||||
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
|
||||
driver->interpreter_version = TT_INTERPRETER_VERSION_40;
|
||||
|
295
src/3rdparty/freetype/src/truetype/ttgload.c
vendored
295
src/3rdparty/freetype/src/truetype/ttgload.c
vendored
@ -35,7 +35,6 @@
|
||||
#endif
|
||||
|
||||
#include "tterrors.h"
|
||||
#include "ttsubpix.h"
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
@ -152,9 +151,6 @@
|
||||
FT_UInt glyph_index )
|
||||
{
|
||||
TT_Face face = loader->face;
|
||||
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
|
||||
TT_Driver driver = (TT_Driver)FT_FACE_DRIVER( face );
|
||||
#endif
|
||||
|
||||
FT_Error error;
|
||||
FT_Stream stream = loader->stream;
|
||||
@ -183,20 +179,6 @@
|
||||
loader->top_bearing = top_bearing;
|
||||
loader->vadvance = advance_height;
|
||||
|
||||
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
|
||||
if ( driver->interpreter_version == TT_INTERPRETER_VERSION_38 &&
|
||||
loader->exec )
|
||||
{
|
||||
loader->exec->sph_tweak_flags = 0;
|
||||
|
||||
/* This may not be the right place for this, but it works... */
|
||||
/* Note that we have to unconditionally load the tweaks since */
|
||||
/* it is possible that glyphs individually switch ClearType's */
|
||||
/* backward compatibility mode on and off. */
|
||||
sph_set_tweaks( loader, glyph_index );
|
||||
}
|
||||
#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
|
||||
|
||||
#ifdef FT_CONFIG_OPTION_INCREMENTAL
|
||||
/* With the incremental interface, these values are set by */
|
||||
/* a call to `tt_get_metrics_incremental'. */
|
||||
@ -798,8 +780,7 @@
|
||||
TT_Hint_Glyph( TT_Loader loader,
|
||||
FT_Bool is_composite )
|
||||
{
|
||||
#if defined TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY || \
|
||||
defined TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
|
||||
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
|
||||
TT_Face face = loader->face;
|
||||
TT_Driver driver = (TT_Driver)FT_FACE_DRIVER( face );
|
||||
#endif
|
||||
@ -820,7 +801,7 @@
|
||||
FT_ARRAY_COPY( zone->org, zone->cur, zone->n_points );
|
||||
|
||||
/* Reset graphics state. */
|
||||
loader->exec->GS = loader->size->GS;
|
||||
exec->GS = loader->size->GS;
|
||||
|
||||
/* XXX: UNDOCUMENTED! Hinting instructions of a composite glyph */
|
||||
/* completely refer to the (already) hinted subglyphs. */
|
||||
@ -860,7 +841,7 @@
|
||||
exec->is_composite = is_composite;
|
||||
exec->pts = *zone;
|
||||
|
||||
error = TT_Run_Context( loader->exec );
|
||||
error = TT_Run_Context( exec );
|
||||
if ( error && exec->pedantic_hinting )
|
||||
return error;
|
||||
|
||||
@ -871,32 +852,20 @@
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
|
||||
/* Save possibly modified glyph phantom points unless in v40 backward */
|
||||
/* compatibility mode, where no movement on the x axis means no reason */
|
||||
/* to change bearings or advance widths. */
|
||||
if ( !( driver->interpreter_version == TT_INTERPRETER_VERSION_40 &&
|
||||
exec->backward_compatibility ) )
|
||||
{
|
||||
#endif
|
||||
loader->pp1 = zone->cur[zone->n_points - 4];
|
||||
loader->pp2 = zone->cur[zone->n_points - 3];
|
||||
loader->pp3 = zone->cur[zone->n_points - 2];
|
||||
loader->pp4 = zone->cur[zone->n_points - 1];
|
||||
|
||||
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
|
||||
}
|
||||
if ( driver->interpreter_version == TT_INTERPRETER_VERSION_40 &&
|
||||
exec->backward_compatibility )
|
||||
return FT_Err_Ok;
|
||||
#endif
|
||||
|
||||
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
|
||||
if ( driver->interpreter_version == TT_INTERPRETER_VERSION_38 )
|
||||
{
|
||||
if ( exec->sph_tweak_flags & SPH_TWEAK_DEEMBOLDEN )
|
||||
FT_Outline_EmboldenXY( &loader->gloader->current.outline, -24, 0 );
|
||||
|
||||
else if ( exec->sph_tweak_flags & SPH_TWEAK_EMBOLDEN )
|
||||
FT_Outline_EmboldenXY( &loader->gloader->current.outline, 24, 0 );
|
||||
}
|
||||
#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
|
||||
loader->pp1 = zone->cur[zone->n_points - 4];
|
||||
loader->pp2 = zone->cur[zone->n_points - 3];
|
||||
loader->pp3 = zone->cur[zone->n_points - 2];
|
||||
loader->pp4 = zone->cur[zone->n_points - 1];
|
||||
|
||||
return FT_Err_Ok;
|
||||
}
|
||||
@ -960,16 +929,6 @@
|
||||
}
|
||||
|
||||
{
|
||||
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
|
||||
TT_Face face = loader->face;
|
||||
TT_Driver driver = (TT_Driver)FT_FACE_DRIVER( face );
|
||||
|
||||
FT_String* family = face->root.family_name;
|
||||
FT_UInt ppem = loader->size->metrics->x_ppem;
|
||||
FT_String* style = face->root.style_name;
|
||||
FT_UInt x_scale_factor = 1000;
|
||||
#endif
|
||||
|
||||
FT_Vector* vec = outline->points;
|
||||
FT_Vector* limit = outline->points + n_points;
|
||||
|
||||
@ -979,52 +938,6 @@
|
||||
FT_Bool do_scale = FALSE;
|
||||
|
||||
|
||||
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
|
||||
|
||||
if ( driver->interpreter_version == TT_INTERPRETER_VERSION_38 )
|
||||
{
|
||||
/* scale, but only if enabled and only if TT hinting is being used */
|
||||
if ( IS_HINTED( loader->load_flags ) )
|
||||
x_scale_factor = sph_test_tweak_x_scaling( face,
|
||||
family,
|
||||
ppem,
|
||||
style,
|
||||
loader->glyph_index );
|
||||
/* scale the glyph */
|
||||
if ( ( loader->load_flags & FT_LOAD_NO_SCALE ) == 0 ||
|
||||
x_scale_factor != 1000 )
|
||||
{
|
||||
x_scale = FT_MulDiv( loader->size->metrics->x_scale,
|
||||
(FT_Long)x_scale_factor, 1000 );
|
||||
y_scale = loader->size->metrics->y_scale;
|
||||
|
||||
/* compensate for any scaling by de/emboldening; */
|
||||
/* the amount was determined via experimentation */
|
||||
if ( x_scale_factor != 1000 && ppem > 11 )
|
||||
{
|
||||
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
|
||||
FT_Vector* orig_points = outline->points;
|
||||
|
||||
|
||||
if ( !IS_DEFAULT_INSTANCE( FT_FACE( loader->face ) ) )
|
||||
outline->points = unrounded;
|
||||
#endif
|
||||
FT_Outline_EmboldenXY( outline,
|
||||
FT_MulFix( 1280 * ppem,
|
||||
1000 - x_scale_factor ),
|
||||
0 );
|
||||
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
|
||||
if ( !IS_DEFAULT_INSTANCE( FT_FACE( loader->face ) ) )
|
||||
outline->points = orig_points;
|
||||
#endif
|
||||
}
|
||||
do_scale = TRUE;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
|
||||
|
||||
{
|
||||
/* scale the glyph */
|
||||
if ( ( loader->load_flags & FT_LOAD_NO_SCALE ) == 0 )
|
||||
@ -1451,45 +1364,31 @@
|
||||
static void
|
||||
tt_loader_set_pp( TT_Loader loader )
|
||||
{
|
||||
FT_Bool subpixel_hinting = 0;
|
||||
FT_Bool grayscale = 0;
|
||||
FT_Bool use_aw_2 = 0;
|
||||
|
||||
#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING
|
||||
TT_Driver driver = (TT_Driver)FT_FACE_DRIVER( loader->face );
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
|
||||
if ( driver->interpreter_version == TT_INTERPRETER_VERSION_38 )
|
||||
{
|
||||
subpixel_hinting = loader->exec ? loader->exec->subpixel_hinting
|
||||
: 0;
|
||||
grayscale = loader->exec ? loader->exec->grayscale
|
||||
: 0;
|
||||
}
|
||||
#endif
|
||||
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
|
||||
if ( driver->interpreter_version == TT_INTERPRETER_VERSION_40 )
|
||||
{
|
||||
subpixel_hinting = loader->exec ? loader->exec->subpixel_hinting_lean
|
||||
: 0;
|
||||
grayscale = loader->exec ? loader->exec->grayscale_cleartype
|
||||
: 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
use_aw_2 = FT_BOOL( subpixel_hinting && grayscale );
|
||||
|
||||
loader->pp1.x = loader->bbox.xMin - loader->left_bearing;
|
||||
loader->pp1.y = 0;
|
||||
loader->pp2.x = loader->pp1.x + loader->advance;
|
||||
loader->pp2.y = 0;
|
||||
|
||||
loader->pp3.x = use_aw_2 ? loader->advance / 2 : 0;
|
||||
loader->pp3.x = 0;
|
||||
loader->pp3.y = loader->bbox.yMax + loader->top_bearing;
|
||||
loader->pp4.x = use_aw_2 ? loader->advance / 2 : 0;
|
||||
loader->pp4.x = 0;
|
||||
loader->pp4.y = loader->pp3.y - loader->vadvance;
|
||||
|
||||
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
|
||||
{
|
||||
TT_Driver driver = (TT_Driver)FT_FACE_DRIVER( loader->face );
|
||||
|
||||
|
||||
if ( driver->interpreter_version == TT_INTERPRETER_VERSION_40 &&
|
||||
loader->exec &&
|
||||
loader->exec->subpixel_hinting_lean &&
|
||||
loader->exec->grayscale_cleartype )
|
||||
{
|
||||
loader->pp3.x = loader->advance / 2;
|
||||
loader->pp4.x = loader->advance / 2;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@ -2277,8 +2176,7 @@
|
||||
#ifdef TT_USE_BYTECODE_INTERPRETER
|
||||
FT_Error error;
|
||||
FT_Bool pedantic = FT_BOOL( load_flags & FT_LOAD_PEDANTIC );
|
||||
#if defined TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY || \
|
||||
defined TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
|
||||
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
|
||||
TT_Driver driver = (TT_Driver)FT_FACE_DRIVER( glyph->face );
|
||||
#endif
|
||||
#endif
|
||||
@ -2298,20 +2196,6 @@
|
||||
FT_Bool grayscale_cleartype;
|
||||
#endif
|
||||
|
||||
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
|
||||
FT_Bool subpixel_hinting = FALSE;
|
||||
|
||||
#if 0
|
||||
/* not used yet */
|
||||
FT_Bool compatible_widths;
|
||||
FT_Bool symmetrical_smoothing;
|
||||
FT_Bool bgr;
|
||||
FT_Bool vertical_lcd;
|
||||
FT_Bool subpixel_positioned;
|
||||
FT_Bool gray_cleartype;
|
||||
#endif
|
||||
#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
|
||||
|
||||
FT_Bool reexecute = FALSE;
|
||||
|
||||
|
||||
@ -2331,6 +2215,9 @@
|
||||
if ( !exec )
|
||||
return FT_THROW( Could_Not_Find_Context );
|
||||
|
||||
grayscale = FT_BOOL( FT_LOAD_TARGET_MODE( load_flags ) !=
|
||||
FT_RENDER_MODE_MONO );
|
||||
|
||||
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
|
||||
if ( driver->interpreter_version == TT_INTERPRETER_VERSION_40 )
|
||||
{
|
||||
@ -2347,6 +2234,7 @@
|
||||
FT_BOOL( subpixel_hinting_lean &&
|
||||
( load_flags &
|
||||
FT_LOAD_TARGET_LCD_V ) );
|
||||
grayscale = FT_BOOL( grayscale && !subpixel_hinting_lean );
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -2356,111 +2244,11 @@
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
|
||||
|
||||
if ( driver->interpreter_version == TT_INTERPRETER_VERSION_38 )
|
||||
{
|
||||
subpixel_hinting = FT_BOOL( ( FT_LOAD_TARGET_MODE( load_flags ) !=
|
||||
FT_RENDER_MODE_MONO ) &&
|
||||
SPH_OPTION_SET_SUBPIXEL );
|
||||
|
||||
if ( subpixel_hinting )
|
||||
grayscale = FALSE;
|
||||
else if ( SPH_OPTION_SET_GRAYSCALE )
|
||||
{
|
||||
grayscale = TRUE;
|
||||
subpixel_hinting = FALSE;
|
||||
}
|
||||
else
|
||||
grayscale = FALSE;
|
||||
|
||||
if ( FT_IS_TRICKY( glyph->face ) )
|
||||
subpixel_hinting = FALSE;
|
||||
|
||||
exec->ignore_x_mode = subpixel_hinting || grayscale;
|
||||
exec->rasterizer_version = SPH_OPTION_SET_RASTERIZER_VERSION;
|
||||
if ( exec->sph_tweak_flags & SPH_TWEAK_RASTERIZER_35 )
|
||||
exec->rasterizer_version = TT_INTERPRETER_VERSION_35;
|
||||
|
||||
#if 1
|
||||
exec->compatible_widths = SPH_OPTION_SET_COMPATIBLE_WIDTHS;
|
||||
exec->symmetrical_smoothing = TRUE;
|
||||
exec->bgr = FALSE;
|
||||
exec->vertical_lcd = FALSE;
|
||||
exec->subpixel_positioned = TRUE;
|
||||
exec->gray_cleartype = FALSE;
|
||||
#else /* 0 */
|
||||
exec->compatible_widths =
|
||||
FT_BOOL( FT_LOAD_TARGET_MODE( load_flags ) !=
|
||||
TT_LOAD_COMPATIBLE_WIDTHS );
|
||||
exec->symmetrical_smoothing =
|
||||
FT_BOOL( FT_LOAD_TARGET_MODE( load_flags ) !=
|
||||
TT_LOAD_SYMMETRICAL_SMOOTHING );
|
||||
exec->bgr =
|
||||
FT_BOOL( FT_LOAD_TARGET_MODE( load_flags ) !=
|
||||
TT_LOAD_BGR );
|
||||
exec->vertical_lcd =
|
||||
FT_BOOL( FT_LOAD_TARGET_MODE( load_flags ) !=
|
||||
TT_LOAD_VERTICAL_LCD );
|
||||
exec->subpixel_positioned =
|
||||
FT_BOOL( FT_LOAD_TARGET_MODE( load_flags ) !=
|
||||
TT_LOAD_SUBPIXEL_POSITIONED );
|
||||
exec->gray_cleartype =
|
||||
FT_BOOL( FT_LOAD_TARGET_MODE( load_flags ) !=
|
||||
TT_LOAD_GRAY_CLEARTYPE );
|
||||
#endif /* 0 */
|
||||
|
||||
}
|
||||
else
|
||||
|
||||
#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
|
||||
|
||||
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
|
||||
if ( driver->interpreter_version == TT_INTERPRETER_VERSION_40 )
|
||||
grayscale = FT_BOOL( !subpixel_hinting_lean &&
|
||||
FT_LOAD_TARGET_MODE( load_flags ) !=
|
||||
FT_RENDER_MODE_MONO );
|
||||
else
|
||||
#endif
|
||||
grayscale = FT_BOOL( FT_LOAD_TARGET_MODE( load_flags ) !=
|
||||
FT_RENDER_MODE_MONO );
|
||||
|
||||
error = TT_Load_Context( exec, face, size );
|
||||
if ( error )
|
||||
return error;
|
||||
|
||||
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
|
||||
|
||||
if ( driver->interpreter_version == TT_INTERPRETER_VERSION_38 )
|
||||
{
|
||||
/* a change from mono to subpixel rendering (and vice versa) */
|
||||
/* requires a re-execution of the CVT program */
|
||||
if ( subpixel_hinting != exec->subpixel_hinting )
|
||||
{
|
||||
FT_TRACE4(( "tt_loader_init: subpixel hinting change,"
|
||||
" re-executing `prep' table\n" ));
|
||||
|
||||
exec->subpixel_hinting = subpixel_hinting;
|
||||
reexecute = TRUE;
|
||||
}
|
||||
|
||||
/* a change from mono to grayscale rendering (and vice versa) */
|
||||
/* requires a re-execution of the CVT program */
|
||||
if ( grayscale != exec->grayscale )
|
||||
{
|
||||
FT_TRACE4(( "tt_loader_init: grayscale hinting change,"
|
||||
" re-executing `prep' table\n" ));
|
||||
|
||||
exec->grayscale = grayscale;
|
||||
reexecute = TRUE;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
|
||||
|
||||
{
|
||||
|
||||
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
|
||||
if ( driver->interpreter_version == TT_INTERPRETER_VERSION_40 )
|
||||
{
|
||||
@ -2518,14 +2306,6 @@
|
||||
if ( exec->GS.instruct_control & 2 )
|
||||
exec->GS = tt_default_graphics_state;
|
||||
|
||||
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
|
||||
/* check whether we have a font hinted for ClearType -- */
|
||||
/* note that this flag can also be modified in a glyph's bytecode */
|
||||
if ( driver->interpreter_version == TT_INTERPRETER_VERSION_38 &&
|
||||
exec->GS.instruct_control & 4 )
|
||||
exec->ignore_x_mode = FALSE;
|
||||
#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
|
||||
|
||||
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
|
||||
/*
|
||||
* Toggle backward compatibility according to what font wants, except
|
||||
@ -2561,13 +2341,6 @@
|
||||
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
|
||||
!( driver->interpreter_version == TT_INTERPRETER_VERSION_40 &&
|
||||
exec->backward_compatibility ) &&
|
||||
#endif
|
||||
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
|
||||
!( driver->interpreter_version == TT_INTERPRETER_VERSION_38 &&
|
||||
!SPH_OPTION_BITMAP_WIDTHS &&
|
||||
FT_LOAD_TARGET_MODE( loader->load_flags ) !=
|
||||
FT_RENDER_MODE_MONO &&
|
||||
exec->compatible_widths ) &&
|
||||
#endif
|
||||
!face->postscript.isFixedPitch )
|
||||
{
|
||||
|
8
src/3rdparty/freetype/src/truetype/ttgxvar.c
vendored
8
src/3rdparty/freetype/src/truetype/ttgxvar.c
vendored
@ -621,10 +621,10 @@
|
||||
{
|
||||
GX_ItemVarData varData = &itemStore->varData[i];
|
||||
|
||||
FT_UInt item_count;
|
||||
FT_UInt word_delta_count;
|
||||
FT_UInt region_idx_count;
|
||||
FT_UInt per_region_size;
|
||||
FT_UInt item_count;
|
||||
FT_UShort word_delta_count;
|
||||
FT_UInt region_idx_count;
|
||||
FT_UInt per_region_size;
|
||||
|
||||
|
||||
if ( FT_STREAM_SEEK( offset + dataOffsetArray[i] ) )
|
||||
|
838
src/3rdparty/freetype/src/truetype/ttinterp.c
vendored
838
src/3rdparty/freetype/src/truetype/ttinterp.c
vendored
File diff suppressed because it is too large
Load Diff
74
src/3rdparty/freetype/src/truetype/ttinterp.h
vendored
74
src/3rdparty/freetype/src/truetype/ttinterp.h
vendored
@ -98,48 +98,6 @@ FT_BEGIN_HEADER
|
||||
} TT_CallRec, *TT_CallStack;
|
||||
|
||||
|
||||
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* These structures define rules used to tweak subpixel hinting for
|
||||
* various fonts. "", 0, "", NULL value indicates to match any value.
|
||||
*/
|
||||
|
||||
#define SPH_MAX_NAME_SIZE 32
|
||||
#define SPH_MAX_CLASS_MEMBERS 100
|
||||
|
||||
typedef struct SPH_TweakRule_
|
||||
{
|
||||
const char family[SPH_MAX_NAME_SIZE];
|
||||
const FT_UInt ppem;
|
||||
const char style[SPH_MAX_NAME_SIZE];
|
||||
const FT_ULong glyph;
|
||||
|
||||
} SPH_TweakRule;
|
||||
|
||||
|
||||
typedef struct SPH_ScaleRule_
|
||||
{
|
||||
const char family[SPH_MAX_NAME_SIZE];
|
||||
const FT_UInt ppem;
|
||||
const char style[SPH_MAX_NAME_SIZE];
|
||||
const FT_ULong glyph;
|
||||
const FT_ULong scale;
|
||||
|
||||
} SPH_ScaleRule;
|
||||
|
||||
|
||||
typedef struct SPH_Font_Class_
|
||||
{
|
||||
const char name[SPH_MAX_NAME_SIZE];
|
||||
const char member[SPH_MAX_CLASS_MEMBERS][SPH_MAX_NAME_SIZE];
|
||||
|
||||
} SPH_Font_Class;
|
||||
|
||||
#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* The main structure for the interpreter which collects all necessary
|
||||
@ -399,38 +357,6 @@ FT_BEGIN_HEADER
|
||||
FT_Bool grayscale_cleartype;
|
||||
#endif /* TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL */
|
||||
|
||||
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
|
||||
TT_Round_Func func_round_sphn; /* subpixel rounding function */
|
||||
|
||||
FT_Bool subpixel_hinting; /* Using subpixel hinting? */
|
||||
FT_Bool ignore_x_mode; /* Standard rendering mode for */
|
||||
/* subpixel hinting. On if gray */
|
||||
/* or subpixel hinting is on. */
|
||||
|
||||
/* The following 6 aren't fully implemented but here for MS rasterizer */
|
||||
/* compatibility. */
|
||||
FT_Bool compatible_widths; /* compatible widths? */
|
||||
FT_Bool symmetrical_smoothing; /* symmetrical_smoothing? */
|
||||
FT_Bool bgr; /* bgr instead of rgb? */
|
||||
FT_Bool vertical_lcd; /* long side of LCD subpixel */
|
||||
/* rectangles is horizontal */
|
||||
FT_Bool subpixel_positioned; /* subpixel positioned */
|
||||
/* (DirectWrite ClearType)? */
|
||||
FT_Bool gray_cleartype; /* ClearType hinting but */
|
||||
/* grayscale rendering */
|
||||
|
||||
FT_Int rasterizer_version; /* MS rasterizer version */
|
||||
|
||||
FT_Bool iup_called; /* IUP called for glyph? */
|
||||
|
||||
FT_ULong sph_tweak_flags; /* flags to control */
|
||||
/* hint tweaks */
|
||||
|
||||
FT_ULong sph_in_func_flags; /* flags to indicate if in */
|
||||
/* special functions */
|
||||
|
||||
#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
|
||||
|
||||
/* We maintain two counters (in addition to the instruction counter) */
|
||||
/* that act as loop detectors for LOOPCALL and jump opcodes with */
|
||||
/* negative arguments. */
|
||||
|
3
src/3rdparty/freetype/src/truetype/ttobjs.c
vendored
3
src/3rdparty/freetype/src/truetype/ttobjs.c
vendored
@ -1481,9 +1481,6 @@
|
||||
TT_Driver driver = (TT_Driver)ttdriver;
|
||||
|
||||
driver->interpreter_version = TT_INTERPRETER_VERSION_35;
|
||||
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
|
||||
driver->interpreter_version = TT_INTERPRETER_VERSION_38;
|
||||
#endif
|
||||
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
|
||||
driver->interpreter_version = TT_INTERPRETER_VERSION_40;
|
||||
#endif
|
||||
|
2
src/3rdparty/freetype/src/truetype/ttobjs.h
vendored
2
src/3rdparty/freetype/src/truetype/ttobjs.h
vendored
@ -162,8 +162,6 @@ FT_BEGIN_HEADER
|
||||
FT_Long end; /* where does it end? */
|
||||
FT_UInt opc; /* function #, or instruction code */
|
||||
FT_Bool active; /* is it active? */
|
||||
FT_Bool inline_delta; /* is function that defines inline delta? */
|
||||
FT_ULong sph_fdef_flags; /* flags to identify special functions */
|
||||
|
||||
} TT_DefRecord, *TT_DefArray;
|
||||
|
||||
|
1013
src/3rdparty/freetype/src/truetype/ttsubpix.c
vendored
1013
src/3rdparty/freetype/src/truetype/ttsubpix.c
vendored
File diff suppressed because it is too large
Load Diff
110
src/3rdparty/freetype/src/truetype/ttsubpix.h
vendored
110
src/3rdparty/freetype/src/truetype/ttsubpix.h
vendored
@ -1,110 +0,0 @@
|
||||
/****************************************************************************
|
||||
*
|
||||
* ttsubpix.h
|
||||
*
|
||||
* TrueType Subpixel Hinting.
|
||||
*
|
||||
* Copyright (C) 2010-2023 by
|
||||
* David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
*
|
||||
* 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 accept it fully.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef TTSUBPIX_H_
|
||||
#define TTSUBPIX_H_
|
||||
|
||||
#include "ttobjs.h"
|
||||
#include "ttinterp.h"
|
||||
|
||||
|
||||
FT_BEGIN_HEADER
|
||||
|
||||
|
||||
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* ID flags to identify special functions at FDEF and runtime.
|
||||
*
|
||||
*/
|
||||
#define SPH_FDEF_INLINE_DELTA_1 0x0000001
|
||||
#define SPH_FDEF_INLINE_DELTA_2 0x0000002
|
||||
#define SPH_FDEF_DIAGONAL_STROKE 0x0000004
|
||||
#define SPH_FDEF_VACUFORM_ROUND_1 0x0000008
|
||||
#define SPH_FDEF_TTFAUTOHINT_1 0x0000010
|
||||
#define SPH_FDEF_SPACING_1 0x0000020
|
||||
#define SPH_FDEF_SPACING_2 0x0000040
|
||||
#define SPH_FDEF_TYPEMAN_STROKES 0x0000080
|
||||
#define SPH_FDEF_TYPEMAN_DIAGENDCTRL 0x0000100
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Tweak flags that are set for each glyph by the below rules.
|
||||
*
|
||||
*/
|
||||
#define SPH_TWEAK_ALLOW_X_DMOVE 0x0000001UL
|
||||
#define SPH_TWEAK_ALWAYS_DO_DELTAP 0x0000002UL
|
||||
#define SPH_TWEAK_ALWAYS_SKIP_DELTAP 0x0000004UL
|
||||
#define SPH_TWEAK_COURIER_NEW_2_HACK 0x0000008UL
|
||||
#define SPH_TWEAK_DEEMBOLDEN 0x0000010UL
|
||||
#define SPH_TWEAK_DO_SHPIX 0x0000020UL
|
||||
#define SPH_TWEAK_EMBOLDEN 0x0000040UL
|
||||
#define SPH_TWEAK_MIAP_HACK 0x0000080UL
|
||||
#define SPH_TWEAK_NORMAL_ROUND 0x0000100UL
|
||||
#define SPH_TWEAK_NO_ALIGNRP_AFTER_IUP 0x0000200UL
|
||||
#define SPH_TWEAK_NO_CALL_AFTER_IUP 0x0000400UL
|
||||
#define SPH_TWEAK_NO_DELTAP_AFTER_IUP 0x0000800UL
|
||||
#define SPH_TWEAK_PIXEL_HINTING 0x0001000UL
|
||||
#define SPH_TWEAK_RASTERIZER_35 0x0002000UL
|
||||
#define SPH_TWEAK_ROUND_NONPIXEL_Y_MOVES 0x0004000UL
|
||||
#define SPH_TWEAK_SKIP_IUP 0x0008000UL
|
||||
#define SPH_TWEAK_SKIP_NONPIXEL_Y_MOVES 0x0010000UL
|
||||
#define SPH_TWEAK_SKIP_OFFPIXEL_Y_MOVES 0x0020000UL
|
||||
#define SPH_TWEAK_TIMES_NEW_ROMAN_HACK 0x0040000UL
|
||||
#define SPH_TWEAK_SKIP_NONPIXEL_Y_MOVES_DELTAP 0x0080000UL
|
||||
|
||||
|
||||
FT_LOCAL( FT_Bool )
|
||||
sph_test_tweak( TT_Face face,
|
||||
const FT_String* family,
|
||||
FT_UInt ppem,
|
||||
const FT_String* style,
|
||||
FT_UInt glyph_index,
|
||||
const SPH_TweakRule* rule,
|
||||
FT_UInt num_rules );
|
||||
|
||||
FT_LOCAL( FT_UInt )
|
||||
sph_test_tweak_x_scaling( TT_Face face,
|
||||
const FT_String* family,
|
||||
FT_UInt ppem,
|
||||
const FT_String* style,
|
||||
FT_UInt glyph_index );
|
||||
|
||||
FT_LOCAL( void )
|
||||
sph_set_tweaks( TT_Loader loader,
|
||||
FT_UInt glyph_index );
|
||||
|
||||
|
||||
/* These macros are defined absent a method for setting them */
|
||||
#define SPH_OPTION_BITMAP_WIDTHS FALSE
|
||||
#define SPH_OPTION_SET_SUBPIXEL TRUE
|
||||
#define SPH_OPTION_SET_GRAYSCALE FALSE
|
||||
#define SPH_OPTION_SET_COMPATIBLE_WIDTHS FALSE
|
||||
#define SPH_OPTION_SET_RASTERIZER_VERSION 38
|
||||
|
||||
#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
|
||||
|
||||
|
||||
FT_END_HEADER
|
||||
|
||||
#endif /* TTSUBPIX_H_ */
|
||||
|
||||
|
||||
/* END */
|
4
src/3rdparty/freetype/src/type1/t1load.c
vendored
4
src/3rdparty/freetype/src/type1/t1load.c
vendored
@ -1773,7 +1773,7 @@
|
||||
*/
|
||||
|
||||
FT_TRACE0(( "parse_subrs: adjusting number of subroutines"
|
||||
" (from %d to %ld)\n",
|
||||
" (from %d to %zu)\n",
|
||||
num_subrs,
|
||||
( parser->root.limit - parser->root.cursor ) >> 3 ));
|
||||
num_subrs = ( parser->root.limit - parser->root.cursor ) >> 3;
|
||||
@ -1948,7 +1948,7 @@
|
||||
if ( num_glyphs > ( limit - cur ) >> 3 )
|
||||
{
|
||||
FT_TRACE0(( "parse_charstrings: adjusting number of glyphs"
|
||||
" (from %d to %ld)\n",
|
||||
" (from %d to %zu)\n",
|
||||
num_glyphs, ( limit - cur ) >> 3 ));
|
||||
num_glyphs = ( limit - cur ) >> 3;
|
||||
}
|
||||
|
2
src/3rdparty/freetype/src/type42/t42parse.c
vendored
2
src/3rdparty/freetype/src/type42/t42parse.c
vendored
@ -872,7 +872,7 @@
|
||||
if ( loader->num_glyphs > ( limit - parser->root.cursor ) >> 2 )
|
||||
{
|
||||
FT_TRACE0(( "t42_parse_charstrings: adjusting number of glyphs"
|
||||
" (from %d to %ld)\n",
|
||||
" (from %d to %zu)\n",
|
||||
loader->num_glyphs,
|
||||
( limit - parser->root.cursor ) >> 2 ));
|
||||
loader->num_glyphs = ( limit - parser->root.cursor ) >> 2;
|
||||
|
Loading…
x
Reference in New Issue
Block a user