diff options
author | Akira Kakuto <kakuto@fuk.kindai.ac.jp> | 2023-02-10 23:57:30 +0000 |
---|---|---|
committer | Akira Kakuto <kakuto@fuk.kindai.ac.jp> | 2023-02-10 23:57:30 +0000 |
commit | 827679dd9f7c68befc4bf816c7fe7da6ccb9d2db (patch) | |
tree | 9e7f6fb78f6bd28222f03128cbec6013cd299605 /Build/source/libs/freetype2/freetype-src/src/bdf/bdfdrivr.c | |
parent | 3b0d3c7d56297f17e5b8975206e930a619120b80 (diff) |
freetype 2.13.0
git-svn-id: svn://tug.org/texlive/trunk@65782 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/libs/freetype2/freetype-src/src/bdf/bdfdrivr.c')
-rw-r--r-- | Build/source/libs/freetype2/freetype-src/src/bdf/bdfdrivr.c | 34 |
1 files changed, 13 insertions, 21 deletions
diff --git a/Build/source/libs/freetype2/freetype-src/src/bdf/bdfdrivr.c b/Build/source/libs/freetype2/freetype-src/src/bdf/bdfdrivr.c index eb73a7cf934..d7e8e0efc5e 100644 --- a/Build/source/libs/freetype2/freetype-src/src/bdf/bdfdrivr.c +++ b/Build/source/libs/freetype2/freetype-src/src/bdf/bdfdrivr.c @@ -92,24 +92,18 @@ THE SOFTWARE. { BDF_CMap cmap = (BDF_CMap)bdfcmap; BDF_encoding_el* encodings = cmap->encodings; - FT_ULong min, max, mid; /* num_encodings */ FT_UShort result = 0; /* encodings->glyph */ + FT_ULong min = 0; + FT_ULong max = cmap->num_encodings; + FT_ULong mid = ( min + max ) >> 1; - min = 0; - max = cmap->num_encodings; - mid = ( min + max ) >> 1; while ( min < max ) { - FT_ULong code; + FT_ULong code = encodings[mid].enc; - if ( mid >= max || mid < min ) - mid = ( min + max ) >> 1; - - code = encodings[mid].enc; - if ( charcode == code ) { /* increase glyph index by 1 -- */ @@ -123,8 +117,10 @@ THE SOFTWARE. else min = mid + 1; - /* prediction in a continuous block */ + /* reasonable prediction in a continuous block */ mid += charcode - code; + if ( mid >= max || mid < min ) + mid = ( min + max ) >> 1; } return result; @@ -137,25 +133,19 @@ THE SOFTWARE. { BDF_CMap cmap = (BDF_CMap)bdfcmap; BDF_encoding_el* encodings = cmap->encodings; - FT_ULong min, max, mid; /* num_encodings */ FT_UShort result = 0; /* encodings->glyph */ FT_ULong charcode = *acharcode + 1; + FT_ULong min = 0; + FT_ULong max = cmap->num_encodings; + FT_ULong mid = ( min + max ) >> 1; - min = 0; - max = cmap->num_encodings; - mid = ( min + max ) >> 1; while ( min < max ) { - FT_ULong code; /* same as BDF_encoding_el.enc */ + FT_ULong code = encodings[mid].enc; - if ( mid >= max || mid < min ) - mid = ( min + max ) >> 1; - - code = encodings[mid].enc; - if ( charcode == code ) { /* increase glyph index by 1 -- */ @@ -171,6 +161,8 @@ THE SOFTWARE. /* prediction in a continuous block */ mid += charcode - code; + if ( mid >= max || mid < min ) + mid = ( min + max ) >> 1; } charcode = 0; |