On Sun, Nov 26, 2017 at 02:33:17PM +0100, Fabian Maurer wrote:
v4 remove global variable don't check if functions are available fix RemoveFontResourceExA test properly release dc add another test for completeness sake v6 Don't truncate strings, instead only compare up to LF_FACESIZE - 1 characters Also fix copying of the strings if they should be too long
Signed-off-by: Fabian Maurer dark.shadow4@web.de
dlls/gdi32/freetype.c | 45 +++++++++++-------------- dlls/gdi32/tests/font.c | 54 ++++++++++++++++++++++++++++++ dlls/gdi32/tests/resource.rc | 3 ++ dlls/gdi32/tests/wine_longname.sfd | 66 +++++++++++++++++++++++++++++++++++++ dlls/gdi32/tests/wine_longname.ttf | Bin 0 -> 2252 bytes 5 files changed, 142 insertions(+), 26 deletions(-) create mode 100644 dlls/gdi32/tests/wine_longname.sfd create mode 100644 dlls/gdi32/tests/wine_longname.ttf
diff --git a/dlls/gdi32/freetype.c b/dlls/gdi32/freetype.c index 346e21dc21..7c5a7ef979 100644 --- a/dlls/gdi32/freetype.c +++ b/dlls/gdi32/freetype.c @@ -1027,7 +1027,7 @@ static Face *find_face_from_filename(const WCHAR *file_name, const WCHAR *face_n LIST_FOR_EACH_ENTRY(family, &font_list, Family, entry) { const struct list *face_list;
if(face_name && strcmpiW(face_name, family->FamilyName))
if(face_name && strncmpiW(face_name, family->FamilyName, LF_FACESIZE - 1)) continue; face_list = get_face_list_from_family(family); LIST_FOR_EACH_ENTRY(face, face_list, Face, entry)
How about truncating FamilyName to LF_FACESIZE-1 and FuillName to LF_FULLFACESIZE-1. Then most comparisons would be strcmpiW(), except the two where we compare FullName with something that came from an lfFaceName?
Huw.