From 02280535bea08395871722f733aaaed70c992260 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Mon, 10 Dec 2018 14:59:49 +0100 Subject: Update bundled Freetype to 2.9.1 This is required to support the new emoji font on Android 9. [ChangeLog][Freetype] Upgraded bundled Freetype version to 2.9.1. This also adds support for the latest emoji font in use on Android 9. Fixes: QTBUG-70657 Change-Id: I99be72f0d23c20aca122b8fdadd4ded87b2edce1 Reviewed-by: Konstantin Ritt --- src/3rdparty/freetype/src/winfonts/Jamfile | 2 +- src/3rdparty/freetype/src/winfonts/fnterrs.h | 10 +-- src/3rdparty/freetype/src/winfonts/module.mk | 2 +- src/3rdparty/freetype/src/winfonts/rules.mk | 2 +- src/3rdparty/freetype/src/winfonts/winfnt.c | 99 +++++++++++++++------------- src/3rdparty/freetype/src/winfonts/winfnt.h | 8 +-- 6 files changed, 65 insertions(+), 58 deletions(-) (limited to 'src/3rdparty/freetype/src/winfonts') diff --git a/src/3rdparty/freetype/src/winfonts/Jamfile b/src/3rdparty/freetype/src/winfonts/Jamfile index 86ee668196..4385e3b39f 100644 --- a/src/3rdparty/freetype/src/winfonts/Jamfile +++ b/src/3rdparty/freetype/src/winfonts/Jamfile @@ -1,6 +1,6 @@ # FreeType 2 src/winfonts Jamfile # -# Copyright 2001-2015 by +# Copyright 2001-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/src/3rdparty/freetype/src/winfonts/fnterrs.h b/src/3rdparty/freetype/src/winfonts/fnterrs.h index 0bf4d0986d..3a86af5aac 100644 --- a/src/3rdparty/freetype/src/winfonts/fnterrs.h +++ b/src/3rdparty/freetype/src/winfonts/fnterrs.h @@ -4,7 +4,7 @@ /* */ /* Win FNT/FON error codes (specification only). */ /* */ -/* Copyright 2001-2015 by */ +/* Copyright 2001-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -23,12 +23,12 @@ /* */ /*************************************************************************/ -#ifndef __FNTERRS_H__ -#define __FNTERRS_H__ +#ifndef FNTERRS_H_ +#define FNTERRS_H_ #include FT_MODULE_ERRORS_H -#undef __FTERRORS_H__ +#undef FTERRORS_H_ #undef FT_ERR_PREFIX #define FT_ERR_PREFIX FNT_Err_ @@ -36,7 +36,7 @@ #include FT_ERRORS_H -#endif /* __FNTERRS_H__ */ +#endif /* FNTERRS_H_ */ /* END */ diff --git a/src/3rdparty/freetype/src/winfonts/module.mk b/src/3rdparty/freetype/src/winfonts/module.mk index 8ba6d7584f..13f9077cfc 100644 --- a/src/3rdparty/freetype/src/winfonts/module.mk +++ b/src/3rdparty/freetype/src/winfonts/module.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2015 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/src/3rdparty/freetype/src/winfonts/rules.mk b/src/3rdparty/freetype/src/winfonts/rules.mk index 4535f54d42..d694d1a771 100644 --- a/src/3rdparty/freetype/src/winfonts/rules.mk +++ b/src/3rdparty/freetype/src/winfonts/rules.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2015 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/src/3rdparty/freetype/src/winfonts/winfnt.c b/src/3rdparty/freetype/src/winfonts/winfnt.c index 4bfa55a429..36bd3148d5 100644 --- a/src/3rdparty/freetype/src/winfonts/winfnt.c +++ b/src/3rdparty/freetype/src/winfonts/winfnt.c @@ -4,7 +4,7 @@ /* */ /* FreeType font driver for Windows FNT/FON files */ /* */ -/* Copyright 1996-2015 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* Copyright 2003 Huw D M Davies for Codeweavers */ /* Copyright 2007 Dmitry Timoshkov for Codeweavers */ @@ -561,7 +561,7 @@ error = fnt_font_load( face->font, stream ); if ( error ) { - FT_TRACE2(( "font #%lu load error %d\n", + FT_TRACE2(( "font #%lu load error 0x%x\n", dir_entry2.name, error )); goto Fail; } @@ -759,6 +759,14 @@ if ( error ) goto Fail; + /* sanity check */ + if ( !face->font->header.pixel_height ) + { + FT_TRACE2(( "invalid pixel height\n" )); + error = FT_THROW( Invalid_File_Format ); + goto Fail; + } + /* we now need to fill the root FT_Face fields */ /* with relevant information */ { @@ -851,10 +859,6 @@ NULL ); if ( error ) goto Fail; - - /* Select default charmap */ - if ( root->num_charmaps ) - root->charmap = root->charmaps[0]; } /* set up remaining flags */ @@ -992,8 +996,6 @@ FT_ULong offset; FT_Bool new_format; - FT_UNUSED( load_flags ); - if ( !face ) { @@ -1047,6 +1049,26 @@ goto Exit; } + bitmap->rows = font->header.pixel_height; + bitmap->pixel_mode = FT_PIXEL_MODE_MONO; + + slot->bitmap_left = 0; + slot->bitmap_top = font->header.ascent; + slot->format = FT_GLYPH_FORMAT_BITMAP; + + /* now set up metrics */ + slot->metrics.width = (FT_Pos)( bitmap->width << 6 ); + slot->metrics.height = (FT_Pos)( bitmap->rows << 6 ); + slot->metrics.horiAdvance = (FT_Pos)( bitmap->width << 6 ); + slot->metrics.horiBearingX = 0; + slot->metrics.horiBearingY = slot->bitmap_top << 6; + + ft_synthesize_vertical_metrics( &slot->metrics, + (FT_Pos)( bitmap->rows << 6 ) ); + + if ( load_flags & FT_LOAD_BITMAP_METRICS_ONLY ) + goto Exit; + /* jump to glyph data */ p = font->fnt_frame + /* font->header.bits_offset */ + offset; @@ -1058,11 +1080,9 @@ FT_Byte* write; - bitmap->pitch = (int)pitch; - bitmap->rows = font->header.pixel_height; - bitmap->pixel_mode = FT_PIXEL_MODE_MONO; - - if ( offset + pitch * bitmap->rows > font->header.file_size ) + bitmap->pitch = (int)pitch; + if ( !pitch || + offset + pitch * bitmap->rows > font->header.file_size ) { FT_TRACE2(( "invalid bitmap width\n" )); error = FT_THROW( Invalid_File_Format ); @@ -1071,7 +1091,7 @@ /* note: since glyphs are stored in columns and not in rows we */ /* can't use ft_glyphslot_set_bitmap */ - if ( FT_ALLOC_MULT( bitmap->buffer, pitch, bitmap->rows ) ) + if ( FT_ALLOC_MULT( bitmap->buffer, bitmap->rows, pitch ) ) goto Exit; column = (FT_Byte*)bitmap->buffer; @@ -1084,22 +1104,9 @@ for ( write = column; p < limit; p++, write += bitmap->pitch ) *write = *p; } - } - - slot->internal->flags = FT_GLYPH_OWN_BITMAP; - slot->bitmap_left = 0; - slot->bitmap_top = font->header.ascent; - slot->format = FT_GLYPH_FORMAT_BITMAP; - /* now set up metrics */ - slot->metrics.width = (FT_Pos)( bitmap->width << 6 ); - slot->metrics.height = (FT_Pos)( bitmap->rows << 6 ); - slot->metrics.horiAdvance = (FT_Pos)( bitmap->width << 6 ); - slot->metrics.horiBearingX = 0; - slot->metrics.horiBearingY = slot->bitmap_top << 6; - - ft_synthesize_vertical_metrics( &slot->metrics, - (FT_Pos)( bitmap->rows << 6 ) ); + slot->internal->flags = FT_GLYPH_OWN_BITMAP; + } Exit: return error; @@ -1121,7 +1128,7 @@ static const FT_Service_WinFntRec winfnt_service_rec = { - winfnt_get_header + winfnt_get_header /* get_header */ }; /* @@ -1161,32 +1168,32 @@ 0x10000L, 0x20000L, - 0, + NULL, /* module-specific interface */ - 0, /* FT_Module_Constructor */ - 0, /* FT_Module_Destructor */ - winfnt_get_service + NULL, /* FT_Module_Constructor module_init */ + NULL, /* FT_Module_Destructor module_done */ + winfnt_get_service /* FT_Module_Requester get_interface */ }, sizeof ( FNT_FaceRec ), sizeof ( FT_SizeRec ), sizeof ( FT_GlyphSlotRec ), - FNT_Face_Init, - FNT_Face_Done, - 0, /* FT_Size_InitFunc */ - 0, /* FT_Size_DoneFunc */ - 0, /* FT_Slot_InitFunc */ - 0, /* FT_Slot_DoneFunc */ + FNT_Face_Init, /* FT_Face_InitFunc init_face */ + FNT_Face_Done, /* FT_Face_DoneFunc done_face */ + NULL, /* FT_Size_InitFunc init_size */ + NULL, /* FT_Size_DoneFunc done_size */ + NULL, /* FT_Slot_InitFunc init_slot */ + NULL, /* FT_Slot_DoneFunc done_slot */ - FNT_Load_Glyph, + FNT_Load_Glyph, /* FT_Slot_LoadFunc load_glyph */ - 0, /* FT_Face_GetKerningFunc */ - 0, /* FT_Face_AttachFunc */ - 0, /* FT_Face_GetAdvancesFunc */ + NULL, /* FT_Face_GetKerningFunc get_kerning */ + NULL, /* FT_Face_AttachFunc attach_file */ + NULL, /* FT_Face_GetAdvancesFunc get_advances */ - FNT_Size_Request, - FNT_Size_Select + FNT_Size_Request, /* FT_Size_RequestFunc request_size */ + FNT_Size_Select /* FT_Size_SelectFunc select_size */ }; diff --git a/src/3rdparty/freetype/src/winfonts/winfnt.h b/src/3rdparty/freetype/src/winfonts/winfnt.h index a39d26f449..4885c9d745 100644 --- a/src/3rdparty/freetype/src/winfonts/winfnt.h +++ b/src/3rdparty/freetype/src/winfonts/winfnt.h @@ -4,7 +4,7 @@ /* */ /* FreeType font driver for Windows FNT/FON files */ /* */ -/* Copyright 1996-2015 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* Copyright 2007 Dmitry Timoshkov for Codeweavers */ /* */ @@ -17,8 +17,8 @@ /***************************************************************************/ -#ifndef __WINFNT_H__ -#define __WINFNT_H__ +#ifndef WINFNT_H_ +#define WINFNT_H_ #include @@ -165,7 +165,7 @@ FT_BEGIN_HEADER FT_END_HEADER -#endif /* __WINFNT_H__ */ +#endif /* WINFNT_H_ */ /* END */ -- cgit v1.2.3