summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/freetype/src/bdf/bdfdrivr.c
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-11-08 09:11:01 +0100
committerQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-11-08 09:11:02 +0100
commit78c687f98eabb3da00026ac2375cdb4bb5770a0a (patch)
tree0bd20a65aa9051229e813bc6b09cb59f8b5778f1 /src/3rdparty/freetype/src/bdf/bdfdrivr.c
parent3e529369eb16704aa0d601a7f4b8e490dc8b772c (diff)
parenta866055d18b2c2efc0f3cf5307d8eac78cce26eb (diff)
Merge remote-tracking branch 'origin/5.14' into 5.15
Diffstat (limited to 'src/3rdparty/freetype/src/bdf/bdfdrivr.c')
-rw-r--r--src/3rdparty/freetype/src/bdf/bdfdrivr.c69
1 files changed, 40 insertions, 29 deletions
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
*
*/