Rémi Bernon : gdi32: Use FreeType as a fallback when loading font faces.
Alexandre Julliard
julliard at winehq.org
Thu Dec 3 15:35:58 CST 2020
Module: wine
Branch: master
Commit: 8aa404bba0f17db479ad2cf214b17cb6f1eae2f7
URL: https://source.winehq.org/git/wine.git/?a=commit;h=8aa404bba0f17db479ad2cf214b17cb6f1eae2f7
Author: Rémi Bernon <rbernon at codeweavers.com>
Date: Tue Dec 1 15:54:51 2020 +0100
gdi32: Use FreeType as a fallback when loading font faces.
Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/gdi32/freetype.c | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/dlls/gdi32/freetype.c b/dlls/gdi32/freetype.c
index 364d58b4450..09c8251de8f 100644
--- a/dlls/gdi32/freetype.c
+++ b/dlls/gdi32/freetype.c
@@ -1218,15 +1218,10 @@ static struct unix_face *unix_face_create( const char *unix_name, void *data_ptr
if (!(This = RtlAllocateHeap( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*This) ))) goto done;
- if (!(This->ft_face = new_ft_face( unix_name, data_ptr, data_size, face_index, flags & ADDFONT_ALLOW_BITMAP )))
- {
- RtlFreeHeap( GetProcessHeap(), 0, This );
- This = NULL;
- }
- else if (opentype_get_ttc_sfnt_v1( data_ptr, data_size, face_index, &face_count, &ttc_sfnt_v1 ) &&
- opentype_get_tt_name_v0( data_ptr, data_size, ttc_sfnt_v1, &tt_name_v0 ) &&
- opentype_get_properties( data_ptr, data_size, ttc_sfnt_v1, &This->font_version,
- &This->fs, &This->ntm_flags ))
+ if (opentype_get_ttc_sfnt_v1( data_ptr, data_size, face_index, &face_count, &ttc_sfnt_v1 ) &&
+ opentype_get_tt_name_v0( data_ptr, data_size, ttc_sfnt_v1, &tt_name_v0 ) &&
+ opentype_get_properties( data_ptr, data_size, ttc_sfnt_v1, &This->font_version,
+ &This->fs, &This->ntm_flags ))
{
struct family_names_data family_names;
struct face_name_data style_name;
@@ -1268,7 +1263,7 @@ static struct unix_face *unix_face_create( const char *unix_name, void *data_ptr
WARN( "full name not found, using %s instead\n", debugstr_w(This->full_name) );
}
}
- else
+ else if ((This->ft_face = new_ft_face( unix_name, data_ptr, data_size, face_index, flags & ADDFONT_ALLOW_BITMAP )))
{
WARN( "unable to parse font, falling back to FreeType\n" );
This->scalable = FT_IS_SCALABLE( This->ft_face );
@@ -1299,6 +1294,11 @@ static struct unix_face *unix_face_create( const char *unix_name, void *data_ptr
if (!This->scalable) get_bitmap_size( This->ft_face, &This->size );
get_fontsig( This->ft_face, &This->fs );
}
+ else
+ {
+ RtlFreeHeap( GetProcessHeap(), 0, This );
+ This = NULL;
+ }
done:
if (unix_name) munmap( data_ptr, data_size );
@@ -1307,7 +1307,7 @@ done:
static void unix_face_destroy( struct unix_face *This )
{
- pFT_Done_Face( This->ft_face );
+ if (This->ft_face) pFT_Done_Face( This->ft_face );
RtlFreeHeap( GetProcessHeap(), 0, This->full_name );
RtlFreeHeap( GetProcessHeap(), 0, This->style_name );
RtlFreeHeap( GetProcessHeap(), 0, This->second_name );
More information about the wine-cvs
mailing list