From 58f56950848bae9c90da3873090c7698e0128b12 Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Wed, 14 Aug 2019 11:13:36 +0200 Subject: Update bundled Freetype to 2.10.1 [ChangeLog][Freetype] Upgraded bundled Freetype version to 2.10.1. Fixes: QTBUG-77466 Change-Id: I1de8b8b03e0ffd0b17eeafff1017df7c638c9279 Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/3rdparty/freetype/src/bdf/bdfdrivr.c | 69 ++++++++++++++++++-------------- 1 file changed, 40 insertions(+), 29 deletions(-) (limited to 'src/3rdparty/freetype/src/bdf/bdfdrivr.c') diff --git a/src/3rdparty/freetype/src/bdf/bdfdrivr.c b/src/3rdparty/freetype/src/bdf/bdfdrivr.c index ca937f89ce..60eb93305e 100644 --- a/src/3rdparty/freetype/src/bdf/bdfdrivr.c +++ b/src/3rdparty/freetype/src/bdf/bdfdrivr.c @@ -41,14 +41,14 @@ THE SOFTWARE. #include "bdferror.h" - /*************************************************************************/ - /* */ - /* The macro FT_COMPONENT is used in trace mode. It is an implicit */ - /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */ - /* messages during execution. */ - /* */ + /************************************************************************** + * + * The macro FT_COMPONENT is used in trace mode. It is an implicit + * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log + * messages during execution. + */ #undef FT_COMPONENT -#define FT_COMPONENT trace_bdfdriver +#define FT_COMPONENT bdfdriver typedef struct BDF_CMapRec_ @@ -99,14 +99,17 @@ THE SOFTWARE. min = 0; max = cmap->num_encodings; + mid = ( min + max ) >> 1; while ( min < max ) { FT_ULong code; - mid = ( min + max ) >> 1; - code = (FT_ULong)encodings[mid].enc; + if ( mid >= max || mid < min ) + mid = ( min + max ) >> 1; + + code = encodings[mid].enc; if ( charcode == code ) { @@ -120,6 +123,9 @@ THE SOFTWARE. max = mid; else min = mid + 1; + + /* prediction in a continuous block */ + mid += charcode - code; } return result; @@ -139,14 +145,17 @@ THE SOFTWARE. min = 0; max = cmap->num_encodings; + mid = ( min + max ) >> 1; while ( min < max ) { FT_ULong code; /* same as BDF_encoding_el.enc */ - mid = ( min + max ) >> 1; - code = (FT_ULong)encodings[mid].enc; + if ( mid >= max || mid < min ) + mid = ( min + max ) >> 1; + + code = encodings[mid].enc; if ( charcode == code ) { @@ -160,12 +169,15 @@ THE SOFTWARE. max = mid; else min = mid + 1; + + /* prediction in a continuous block */ + mid += charcode - code; } charcode = 0; if ( min < cmap->num_encodings ) { - charcode = (FT_ULong)encodings[min].enc; + charcode = encodings[min].enc; result = encodings[min].glyph + 1; } @@ -204,13 +216,13 @@ THE SOFTWARE. bdf_font_t* font = bdf->bdffont; bdf_property_t* prop; - char* strings[4] = { NULL, NULL, NULL, NULL }; - size_t nn, len, lengths[4]; + const char* strings[4] = { NULL, NULL, NULL, NULL }; + size_t lengths[4], nn, len; face->style_flags = 0; - prop = bdf_get_font_property( font, (char *)"SLANT" ); + prop = bdf_get_font_property( font, "SLANT" ); if ( prop && prop->format == BDF_ATOM && prop->value.atom && ( *(prop->value.atom) == 'O' || *(prop->value.atom) == 'o' || @@ -218,30 +230,30 @@ THE SOFTWARE. { face->style_flags |= FT_STYLE_FLAG_ITALIC; strings[2] = ( *(prop->value.atom) == 'O' || *(prop->value.atom) == 'o' ) - ? (char *)"Oblique" - : (char *)"Italic"; + ? "Oblique" + : "Italic"; } - prop = bdf_get_font_property( font, (char *)"WEIGHT_NAME" ); + prop = bdf_get_font_property( font, "WEIGHT_NAME" ); if ( prop && prop->format == BDF_ATOM && prop->value.atom && ( *(prop->value.atom) == 'B' || *(prop->value.atom) == 'b' ) ) { face->style_flags |= FT_STYLE_FLAG_BOLD; - strings[1] = (char *)"Bold"; + strings[1] = "Bold"; } - prop = bdf_get_font_property( font, (char *)"SETWIDTH_NAME" ); + prop = bdf_get_font_property( font, "SETWIDTH_NAME" ); if ( prop && prop->format == BDF_ATOM && prop->value.atom && *(prop->value.atom) && !( *(prop->value.atom) == 'N' || *(prop->value.atom) == 'n' ) ) - strings[3] = (char *)(prop->value.atom); + strings[3] = (const char *)(prop->value.atom); - prop = bdf_get_font_property( font, (char *)"ADD_STYLE_NAME" ); + prop = bdf_get_font_property( font, "ADD_STYLE_NAME" ); if ( prop && prop->format == BDF_ATOM && prop->value.atom && *(prop->value.atom) && !( *(prop->value.atom) == 'N' || *(prop->value.atom) == 'n' ) ) - strings[0] = (char *)(prop->value.atom); + strings[0] = (const char *)(prop->value.atom); for ( len = 0, nn = 0; nn < 4; nn++ ) { @@ -255,7 +267,7 @@ THE SOFTWARE. if ( len == 0 ) { - strings[0] = (char *)"Regular"; + strings[0] = "Regular"; lengths[0] = ft_strlen( strings[0] ); len = lengths[0] + 1; } @@ -271,7 +283,7 @@ THE SOFTWARE. for ( nn = 0; nn < 4; nn++ ) { - char* src = strings[nn]; + const char* src = strings[nn]; len = lengths[nn]; @@ -401,8 +413,7 @@ THE SOFTWARE. bdfface->face_index = 0; bdfface->face_flags |= FT_FACE_FLAG_FIXED_SIZES | - FT_FACE_FLAG_HORIZONTAL | - FT_FACE_FLAG_FAST_GLYPHS; + FT_FACE_FLAG_HORIZONTAL; prop = bdf_get_font_property( font, "SPACING" ); if ( prop && prop->format == BDF_ATOM && @@ -863,7 +874,7 @@ THE SOFTWARE. /* * - * BDF SERVICE + * BDF SERVICE * */ @@ -939,7 +950,7 @@ THE SOFTWARE. /* * - * SERVICES LIST + * SERVICES LIST * */ -- cgit v1.2.3