diff options
Diffstat (limited to 'src/3rdparty/freetype/src/type42/t42objs.c')
-rw-r--r-- | src/3rdparty/freetype/src/type42/t42objs.c | 37 |
1 files changed, 23 insertions, 14 deletions
diff --git a/src/3rdparty/freetype/src/type42/t42objs.c b/src/3rdparty/freetype/src/type42/t42objs.c index d31bace451..bf4028e751 100644 --- a/src/3rdparty/freetype/src/type42/t42objs.c +++ b/src/3rdparty/freetype/src/type42/t42objs.c @@ -4,7 +4,7 @@ * * Type 42 objects manager (body). * - * Copyright (C) 2002-2019 by + * Copyright (C) 2002-2023 by * Roberto Alameda. * * This file is part of the FreeType project, and may only be used, @@ -19,9 +19,9 @@ #include "t42objs.h" #include "t42parse.h" #include "t42error.h" -#include FT_INTERNAL_DEBUG_H -#include FT_LIST_H -#include FT_TRUETYPE_IDS_H +#include <freetype/internal/ftdebug.h> +#include <freetype/ftlist.h> +#include <freetype/ttnameid.h> #undef FT_COMPONENT @@ -44,14 +44,8 @@ parser = &loader.parser; - if ( FT_ALLOC( face->ttf_data, 12 ) ) - goto Exit; - - /* while parsing the font we always update `face->ttf_size' so that */ - /* even in case of buggy data (which might lead to premature end of */ - /* scanning without causing an error) the call to `FT_Open_Face' in */ - /* `T42_Face_Init' passes the correct size */ - face->ttf_size = 12; + face->ttf_data = NULL; + face->ttf_size = 0; error = t42_parser_init( parser, face->root.stream, @@ -152,6 +146,11 @@ Exit: t42_loader_done( &loader ); + if ( error ) + { + FT_FREE( face->ttf_data ); + face->ttf_size = 0; + } return error; } @@ -510,7 +509,8 @@ error = FT_New_Size( t42face->ttf_face, &ttsize ); - t42size->ttsize = ttsize; + if ( !error ) + t42size->ttsize = ttsize; FT_Activate_Size( ttsize ); @@ -582,6 +582,7 @@ FT_Face face = t42slot->face; T42_Face t42face = (T42_Face)face; FT_GlyphSlot ttslot; + FT_Memory memory = face->memory; FT_Error error = FT_Err_Ok; @@ -593,9 +594,15 @@ else { error = FT_New_GlyphSlot( t42face->ttf_face, &ttslot ); - slot->ttslot = ttslot; + if ( !error ) + slot->ttslot = ttslot; } + /* share the loader so that the autohinter can see it */ + FT_GlyphLoader_Done( slot->ttslot->internal->loader ); + FT_FREE( slot->ttslot->internal ); + slot->ttslot->internal = t42slot->internal; + return error; } @@ -606,6 +613,8 @@ T42_GlyphSlot slot = (T42_GlyphSlot)t42slot; + /* do not destroy the inherited internal structure just yet */ + slot->ttslot->internal = NULL; FT_Done_GlyphSlot( slot->ttslot ); } |