diff options
author | Konstantin Ritt <ritt.ks@gmail.com> | 2015-11-02 07:10:28 +0400 |
---|---|---|
committer | Konstantin Ritt <ritt.ks@gmail.com> | 2015-11-03 16:21:10 +0000 |
commit | dba44cd4e5754b579f2184a864ffe7b79b0a7e56 (patch) | |
tree | c8829051b16c8a78f049fb05bae9322293143c91 /src/3rdparty/freetype/src/bdf | |
parent | e056be144a0207699b42a01b6d4cb6f19be474d7 (diff) |
Update bundled FreeType to 2.6.1
Change-Id: Ic489f8aa8ad42da3922f542e6c9064afe44f3799
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Diffstat (limited to 'src/3rdparty/freetype/src/bdf')
-rw-r--r-- | src/3rdparty/freetype/src/bdf/Jamfile | 6 | ||||
-rw-r--r-- | src/3rdparty/freetype/src/bdf/bdf.h | 22 | ||||
-rw-r--r-- | src/3rdparty/freetype/src/bdf/bdfdrivr.c | 41 | ||||
-rw-r--r-- | src/3rdparty/freetype/src/bdf/bdfdrivr.h | 2 | ||||
-rw-r--r-- | src/3rdparty/freetype/src/bdf/bdflib.c | 160 | ||||
-rw-r--r-- | src/3rdparty/freetype/src/bdf/rules.mk | 5 |
6 files changed, 142 insertions, 94 deletions
diff --git a/src/3rdparty/freetype/src/bdf/Jamfile b/src/3rdparty/freetype/src/bdf/Jamfile index da23ccd0ad..86b85fa3e4 100644 --- a/src/3rdparty/freetype/src/bdf/Jamfile +++ b/src/3rdparty/freetype/src/bdf/Jamfile @@ -1,6 +1,6 @@ # FreeType 2 src/bdf Jamfile # -# Copyright 2002 by +# Copyright 2002-2015 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, @@ -16,7 +16,9 @@ SubDir FT2_TOP $(FT2_SRC_DIR) bdf ; if $(FT2_MULTI) { - _sources = bdfdrivr bdflib ; + _sources = bdfdrivr + bdflib + ; } else { diff --git a/src/3rdparty/freetype/src/bdf/bdf.h b/src/3rdparty/freetype/src/bdf/bdf.h index d11be6f147..f24d925d8f 100644 --- a/src/3rdparty/freetype/src/bdf/bdf.h +++ b/src/3rdparty/freetype/src/bdf/bdf.h @@ -40,12 +40,12 @@ FT_BEGIN_HEADER /* Imported from bdfP.h */ -#define _bdf_glyph_modified( map, e ) \ - ( (map)[(e) >> 5] & ( 1 << ( (e) & 31 ) ) ) -#define _bdf_set_glyph_modified( map, e ) \ - ( (map)[(e) >> 5] |= ( 1 << ( (e) & 31 ) ) ) -#define _bdf_clear_glyph_modified( map, e ) \ - ( (map)[(e) >> 5] &= ~( 1 << ( (e) & 31 ) ) ) +#define _bdf_glyph_modified( map, e ) \ + ( (map)[(e) >> 5] & ( 1UL << ( (e) & 31 ) ) ) +#define _bdf_set_glyph_modified( map, e ) \ + ( (map)[(e) >> 5] |= ( 1UL << ( (e) & 31 ) ) ) +#define _bdf_clear_glyph_modified( map, e ) \ + ( (map)[(e) >> 5] &= ~( 1UL << ( (e) & 31 ) ) ) /* end of bdfP.h */ @@ -167,10 +167,10 @@ FT_BEGIN_HEADER typedef struct hashtable_ { - int limit; - int size; - int used; - hashnode* table; + unsigned int limit; + unsigned int size; + unsigned int used; + hashnode* table; } hashtable; @@ -194,7 +194,7 @@ FT_BEGIN_HEADER char* name; /* Name of the font. */ bdf_bbx_t bbx; /* Font bounding box. */ - long point_size; /* Point size of the font. */ + unsigned long point_size; /* Point size of the font. */ unsigned long resolution_x; /* Font horizontal resolution. */ unsigned long resolution_y; /* Font vertical resolution. */ diff --git a/src/3rdparty/freetype/src/bdf/bdfdrivr.c b/src/3rdparty/freetype/src/bdf/bdfdrivr.c index 55a428c1b6..404af517e5 100644 --- a/src/3rdparty/freetype/src/bdf/bdfdrivr.c +++ b/src/3rdparty/freetype/src/bdf/bdfdrivr.c @@ -33,7 +33,7 @@ THE SOFTWARE. #include FT_TRUETYPE_IDS_H #include FT_SERVICE_BDF_H -#include FT_SERVICE_XFREE86_NAME_H +#include FT_SERVICE_FONT_FORMAT_H #include "bdf.h" #include "bdfdrivr.h" @@ -106,7 +106,7 @@ THE SOFTWARE. mid = ( min + max ) >> 1; - code = encodings[mid].enc; + code = (FT_ULong)encodings[mid].enc; if ( charcode == code ) { @@ -146,7 +146,7 @@ THE SOFTWARE. mid = ( min + max ) >> 1; - code = encodings[mid].enc; + code = (FT_ULong)encodings[mid].enc; if ( charcode == code ) { @@ -165,7 +165,7 @@ THE SOFTWARE. charcode = 0; if ( min < cmap->num_encodings ) { - charcode = encodings[min].enc; + charcode = (FT_ULong)encodings[min].enc; result = encodings[min].glyph + 1; } @@ -379,7 +379,8 @@ THE SOFTWARE. * an invalid argument error when the font could be * opened by the specified driver. */ - if ( face_index > 0 ) { + if ( face_index > 0 && ( face_index & 0xFFFF ) > 0 ) + { FT_ERROR(( "BDF_Face_Init: invalid face index\n" )); BDF_Face_Done( bdfface ); return FT_THROW( Invalid_Argument ); @@ -420,14 +421,14 @@ THE SOFTWARE. goto Exit; } else - bdfface->family_name = 0; + bdfface->family_name = NULL; if ( ( error = bdf_interpret_style( face ) ) != 0 ) goto Exit; /* the number of glyphs (with one slot for the undefined glyph */ /* at position 0 and all unencoded glyphs) */ - bdfface->num_glyphs = font->glyphs_size + 1; + bdfface->num_glyphs = (FT_Long)( font->glyphs_size + 1 ); bdfface->num_fixed_sizes = 1; if ( FT_NEW_ARRAY( bdfface->available_sizes, 1 ) ) @@ -494,7 +495,7 @@ THE SOFTWARE. { (face->en_table[n]).enc = cur[n].encoding; FT_TRACE4(( " idx %d, val 0x%lX\n", n, cur[n].encoding )); - (face->en_table[n]).glyph = (FT_Short)n; + (face->en_table[n]).glyph = (FT_UShort)n; if ( cur[n].encoding == font->default_char ) { @@ -509,7 +510,7 @@ THE SOFTWARE. /* charmaps */ { - bdf_property_t *charset_registry = 0, *charset_encoding = 0; + bdf_property_t *charset_registry, *charset_encoding; FT_Bool unicode_charmap = 0; @@ -615,9 +616,9 @@ THE SOFTWARE. FT_Select_Metrics( size->face, strike_index ); - size->metrics.ascender = bdffont->font_ascent << 6; - size->metrics.descender = -bdffont->font_descent << 6; - size->metrics.max_advance = bdffont->bbx.width << 6; + size->metrics.ascender = bdffont->font_ascent * 64; + size->metrics.descender = -bdffont->font_descent * 64; + size->metrics.max_advance = bdffont->bbx.width * 64; return FT_Err_Ok; } @@ -734,18 +735,18 @@ THE SOFTWARE. slot->bitmap_left = glyph.bbx.x_offset; slot->bitmap_top = glyph.bbx.ascent; - slot->metrics.horiAdvance = glyph.dwidth << 6; - slot->metrics.horiBearingX = glyph.bbx.x_offset << 6; - slot->metrics.horiBearingY = glyph.bbx.ascent << 6; - slot->metrics.width = bitmap->width << 6; - slot->metrics.height = bitmap->rows << 6; + slot->metrics.horiAdvance = (FT_Pos)( glyph.dwidth * 64 ); + slot->metrics.horiBearingX = (FT_Pos)( glyph.bbx.x_offset * 64 ); + slot->metrics.horiBearingY = (FT_Pos)( glyph.bbx.ascent * 64 ); + slot->metrics.width = (FT_Pos)( bitmap->width * 64 ); + slot->metrics.height = (FT_Pos)( bitmap->rows * 64 ); /* * XXX DWIDTH1 and VVECTOR should be parsed and * used here, provided such fonts do exist. */ ft_synthesize_vertical_metrics( &slot->metrics, - bdf->bdffont->bbx.height << 6 ); + bdf->bdffont->bbx.height * 64 ); Exit: return error; @@ -836,8 +837,8 @@ THE SOFTWARE. static const FT_ServiceDescRec bdf_services[] = { - { FT_SERVICE_ID_BDF, &bdf_service_bdf }, - { FT_SERVICE_ID_XF86_NAME, FT_XF86_FORMAT_BDF }, + { FT_SERVICE_ID_BDF, &bdf_service_bdf }, + { FT_SERVICE_ID_FONT_FORMAT, FT_FONT_FORMAT_BDF }, { NULL, NULL } }; diff --git a/src/3rdparty/freetype/src/bdf/bdfdrivr.h b/src/3rdparty/freetype/src/bdf/bdfdrivr.h index ca0dae50d2..3c61d644f4 100644 --- a/src/3rdparty/freetype/src/bdf/bdfdrivr.h +++ b/src/3rdparty/freetype/src/bdf/bdfdrivr.h @@ -43,7 +43,7 @@ FT_BEGIN_HEADER typedef struct BDF_encoding_el_ { - FT_ULong enc; + FT_Long enc; FT_UShort glyph; } BDF_encoding_el; diff --git a/src/3rdparty/freetype/src/bdf/bdflib.c b/src/3rdparty/freetype/src/bdf/bdflib.c index abcfdee7be..414deb58ad 100644 --- a/src/3rdparty/freetype/src/bdf/bdflib.c +++ b/src/3rdparty/freetype/src/bdf/bdflib.c @@ -243,7 +243,7 @@ /* Mocklisp hash function. */ while ( *kp ) - res = ( res << 5 ) - res + *kp++; + res = ( res << 5 ) - res + (unsigned long)*kp++; ndp = bp + ( res % ht->size ); while ( *ndp ) @@ -264,9 +264,9 @@ hash_rehash( hashtable* ht, FT_Memory memory ) { - hashnode* obp = ht->table, *bp, *nbp; - int i, sz = ht->size; - FT_Error error = FT_Err_Ok; + hashnode* obp = ht->table, *bp, *nbp; + unsigned int i, sz = ht->size; + FT_Error error = FT_Err_Ok; ht->size <<= 1; @@ -294,8 +294,8 @@ hash_init( hashtable* ht, FT_Memory memory ) { - int sz = INITIAL_HT_SIZE; - FT_Error error = FT_Err_Ok; + unsigned int sz = INITIAL_HT_SIZE; + FT_Error error = FT_Err_Ok; ht->size = sz; @@ -316,8 +316,8 @@ { if ( ht != 0 ) { - int i, sz = ht->size; - hashnode* bp = ht->table; + unsigned int i, sz = ht->size; + hashnode* bp = ht->table; for ( i = 0; i < sz; i++, bp++ ) @@ -570,10 +570,11 @@ char* line, unsigned long linelen ) { - int mult, final_empty; - char *sp, *ep, *end; - char seps[32]; - FT_Error error = FT_Err_Ok; + unsigned long final_empty; + int mult; + char *sp, *ep, *end; + char seps[32]; + FT_Error error = FT_Err_Ok; /* Initialize the list. */ @@ -682,7 +683,7 @@ unsigned long lineno, buf_size; int refill, hold, to_skip; ptrdiff_t bytes, start, end, cursor, avail; - char* buf = 0; + char* buf = NULL; FT_Memory memory = stream->memory; FT_Error error = FT_Err_Ok; @@ -715,7 +716,7 @@ { bytes = (ptrdiff_t)FT_Stream_TryRead( stream, (FT_Byte*)buf + cursor, - (FT_ULong)( buf_size - cursor ) ); + buf_size - (unsigned long)cursor ); avail = cursor + bytes; cursor = 0; refill = 0; @@ -760,7 +761,7 @@ if ( FT_RENEW_ARRAY( buf, buf_size, new_size ) ) goto Exit; - cursor = buf_size; + cursor = (ptrdiff_t)buf_size; buf_size = new_size; } else @@ -858,9 +859,9 @@ /* Routine to convert an ASCII string into an unsigned long integer. */ static unsigned long - _bdf_atoul( char* s, - char** end, - int base ) + _bdf_atoul( char* s, + char** end, + unsigned int base ) { unsigned long v; const unsigned char* dmap; @@ -903,7 +904,7 @@ } - /* Routine to convert an ASCII string into an signed long integer. */ + /* Routine to convert an ASCII string into a signed long integer. */ static long _bdf_atol( char* s, char** end, @@ -958,7 +959,54 @@ } - /* Routine to convert an ASCII string into an signed short integer. */ + /* Routine to convert an ASCII string into an unsigned short integer. */ + static unsigned short + _bdf_atous( char* s, + char** end, + unsigned int base ) + { + unsigned short v; + const unsigned char* dmap; + + + if ( s == 0 || *s == 0 ) + return 0; + + /* Make sure the radix is something recognizable. Default to 10. */ + switch ( base ) + { + case 8: + dmap = odigits; + break; + case 16: + dmap = hdigits; + break; + default: + base = 10; + dmap = ddigits; + break; + } + + /* Check for the special hex prefix. */ + if ( *s == '0' && + ( *( s + 1 ) == 'x' || *( s + 1 ) == 'X' ) ) + { + base = 16; + dmap = hdigits; + s += 2; + } + + for ( v = 0; sbitset( dmap, *s ); s++ ) + v = (unsigned short)( v * base + a2i[(int)*s] ); + + if ( end != 0 ) + *end = s; + + return v; + } + + + /* Routine to convert an ASCII string into a signed short integer. */ static short _bdf_atos( char* s, char** end, @@ -1115,20 +1163,20 @@ /* Parse flags. */ -#define _BDF_START 0x0001 -#define _BDF_FONT_NAME 0x0002 -#define _BDF_SIZE 0x0004 -#define _BDF_FONT_BBX 0x0008 -#define _BDF_PROPS 0x0010 -#define _BDF_GLYPHS 0x0020 -#define _BDF_GLYPH 0x0040 -#define _BDF_ENCODING 0x0080 -#define _BDF_SWIDTH 0x0100 -#define _BDF_DWIDTH 0x0200 -#define _BDF_BBX 0x0400 -#define _BDF_BITMAP 0x0800 - -#define _BDF_SWIDTH_ADJ 0x1000 +#define _BDF_START 0x0001U +#define _BDF_FONT_NAME 0x0002U +#define _BDF_SIZE 0x0004U +#define _BDF_FONT_BBX 0x0008U +#define _BDF_PROPS 0x0010U +#define _BDF_GLYPHS 0x0020U +#define _BDF_GLYPH 0x0040U +#define _BDF_ENCODING 0x0080U +#define _BDF_SWIDTH 0x0100U +#define _BDF_DWIDTH 0x0200U +#define _BDF_BBX 0x0400U +#define _BDF_BITMAP 0x0800U + +#define _BDF_SWIDTH_ADJ 0x1000U #define _BDF_GLYPH_BITS ( _BDF_GLYPH | \ _BDF_ENCODING | \ @@ -1703,7 +1751,7 @@ glyph->encoding = p->glyph_enc; /* Reset the initial glyph info. */ - p->glyph_name = 0; + p->glyph_name = NULL; } else { @@ -1724,14 +1772,14 @@ glyph = font->unencoded + font->unencoded_used; glyph->name = p->glyph_name; - glyph->encoding = font->unencoded_used++; + glyph->encoding = (long)font->unencoded_used++; } else /* Free up the glyph name if the unencoded shouldn't be */ /* kept. */ FT_FREE( p->glyph_name ); - p->glyph_name = 0; + p->glyph_name = NULL; } /* Clear the flags that might be added when width and height are */ @@ -1864,8 +1912,8 @@ if ( error ) goto Exit; - glyph->bbx.width = _bdf_atos( p->list.field[1], 0, 10 ); - glyph->bbx.height = _bdf_atos( p->list.field[2], 0, 10 ); + glyph->bbx.width = _bdf_atous( p->list.field[1], 0, 10 ); + glyph->bbx.height = _bdf_atous( p->list.field[2], 0, 10 ); glyph->bbx.x_offset = _bdf_atos( p->list.field[3], 0, 10 ); glyph->bbx.y_offset = _bdf_atos( p->list.field[4], 0, 10 ); @@ -2225,8 +2273,8 @@ if ( error ) goto Exit; - p->font->bbx.width = _bdf_atos( p->list.field[1], 0, 10 ); - p->font->bbx.height = _bdf_atos( p->list.field[2], 0, 10 ); + p->font->bbx.width = _bdf_atous( p->list.field[1], 0, 10 ); + p->font->bbx.height = _bdf_atous( p->list.field[2], 0, 10 ); p->font->bbx.x_offset = _bdf_atos( p->list.field[3], 0, 10 ); p->font->bbx.y_offset = _bdf_atos( p->list.field[4], 0, 10 ); @@ -2298,29 +2346,23 @@ /* Check for the bits per pixel field. */ if ( p->list.used == 5 ) { - unsigned short bitcount, i, shift; + unsigned short bpp; - p->font->bpp = (unsigned short)_bdf_atos( p->list.field[4], 0, 10 ); + bpp = (unsigned short)_bdf_atos( p->list.field[4], 0, 10 ); - /* Only values 1, 2, 4, 8 are allowed. */ - shift = p->font->bpp; - bitcount = 0; - for ( i = 0; shift > 0; i++ ) - { - if ( shift & 1 ) - bitcount = i; - shift >>= 1; - } - - shift = (short)( ( bitcount > 3 ) ? 8 : ( 1 << bitcount ) ); + /* Only values 1, 2, 4, 8 are allowed for greymap fonts. */ + if ( bpp > 4 ) + p->font->bpp = 8; + else if ( bpp > 2 ) + p->font->bpp = 4; + else if ( bpp > 1 ) + p->font->bpp = 2; + else + p->font->bpp = 1; - if ( p->font->bpp > shift || p->font->bpp != shift ) - { - /* select next higher value */ - p->font->bpp = (unsigned short)( shift << 1 ); + if ( p->font->bpp != bpp ) FT_TRACE2(( "_bdf_parse_start: " ACMSG11, p->font->bpp )); - } } else p->font->bpp = 1; diff --git a/src/3rdparty/freetype/src/bdf/rules.mk b/src/3rdparty/freetype/src/bdf/rules.mk index 6ff1614dde..d1dd76b1c3 100644 --- a/src/3rdparty/freetype/src/bdf/rules.mk +++ b/src/3rdparty/freetype/src/bdf/rules.mk @@ -32,7 +32,10 @@ BDF_DIR := $(SRC_DIR)/bdf -BDF_COMPILE := $(FT_COMPILE) $I$(subst /,$(COMPILER_SEP),$(BDF_DIR)) +BDF_COMPILE := $(CC) $(ANSIFLAGS) \ + $I$(subst /,$(COMPILER_SEP),$(BDF_DIR)) \ + $(INCLUDE_FLAGS) \ + $(FT_CFLAGS) # bdf driver sources (i.e., C files) |