Rémi Bernon : gdi32/tests: Test extended TTF font names and collisions.
Alexandre Julliard
julliard at winehq.org
Tue Sep 8 15:36:15 CDT 2020
Module: wine
Branch: master
Commit: afc857436a424f48c029826dd050e325ff408925
URL: https://source.winehq.org/git/wine.git/?a=commit;h=afc857436a424f48c029826dd050e325ff408925
Author: Rémi Bernon <rbernon at codeweavers.com>
Date: Mon Sep 7 15:18:53 2020 +0200
gdi32/tests: Test extended TTF font names and collisions.
This shows that although Windows is only matching family names up to
LF_FACESIZE chars, and that it doesn't match against the preferred /
typographic family names and styles, it still keeps the faces separate
when the full names don't match. Wine incorrectly discard one of them.
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/tests/Makefile.in | 2 +
dlls/gdi32/tests/font.c | 71 ++++++++++++++++++++++++++
dlls/gdi32/tests/resource.rc | 6 +++
dlls/gdi32/tests/wine_ttfnames.sfd | 85 ++++++++++++++++++++++++++++++++
dlls/gdi32/tests/wine_ttfnames.ttf | Bin 0 -> 2232 bytes
dlls/gdi32/tests/wine_ttfnames_bold.sfd | 85 ++++++++++++++++++++++++++++++++
dlls/gdi32/tests/wine_ttfnames_bold.ttf | Bin 0 -> 2272 bytes
7 files changed, 249 insertions(+)
diff --git a/dlls/gdi32/tests/Makefile.in b/dlls/gdi32/tests/Makefile.in
index 9d82c278e9..8b722cfe5d 100644
--- a/dlls/gdi32/tests/Makefile.in
+++ b/dlls/gdi32/tests/Makefile.in
@@ -22,6 +22,8 @@ FONT_SRCS = \
vertical.sfd \
wine_longname.sfd \
wine_test.sfd \
+ wine_ttfnames.sfd \
+ wine_ttfnames_bold.sfd \
wine_vdmx.sfd
RC_SRCS = resource.rc
diff --git a/dlls/gdi32/tests/font.c b/dlls/gdi32/tests/font.c
index ad894dfdca..b1848a4374 100644
--- a/dlls/gdi32/tests/font.c
+++ b/dlls/gdi32/tests/font.c
@@ -6940,6 +6940,76 @@ static void test_long_names(void)
ReleaseDC(NULL, dc);
}
+static void test_ttf_names(void)
+{
+ struct enum_fullname_data efnd;
+ char ttf_name[MAX_PATH], ttf_name_bold[MAX_PATH];
+ LOGFONTA font = {0};
+ HFONT handle_font;
+ int ret;
+ HDC dc;
+
+ if (!write_ttf_file("wine_ttfnames.ttf", ttf_name))
+ {
+ skip("Failed to create ttf file for testing\n");
+ return;
+ }
+
+ if (!write_ttf_file("wine_ttfnames_bold.ttf", ttf_name_bold))
+ {
+ skip("Failed to create ttf file for testing\n");
+ DeleteFileA(ttf_name);
+ return;
+ }
+
+ ret = AddFontResourceExA(ttf_name, FR_PRIVATE, 0);
+ ok(ret, "AddFontResourceEx() failed\n");
+
+ ret = AddFontResourceExA(ttf_name_bold, FR_PRIVATE, 0);
+ ok(ret, "AddFontResourceEx() failed\n");
+
+ dc = GetDC(NULL);
+
+ strcpy(font.lfFaceName, "Wine_TTF_Names_Long_Family1_Con");
+ memset(&efnd, 0, sizeof(efnd));
+ EnumFontFamiliesExA(dc, &font, enum_fullname_data_proc, (LPARAM)&efnd, 0);
+ ok(efnd.total == 0, "EnumFontFamiliesExA must not find font.\n");
+
+ /* Windows doesn't match with Typographic/Preferred Family tags */
+ strcpy(font.lfFaceName, "Wine TTF Names Long Family1");
+ memset(&efnd, 0, sizeof(efnd));
+ EnumFontFamiliesExA(dc, &font, enum_fullname_data_proc, (LPARAM)&efnd, 0);
+ ok(efnd.total == 0, "EnumFontFamiliesExA must not find font.\n");
+
+ strcpy(font.lfFaceName, "Wine TTF Names Long Family1 Ext");
+ memset(&efnd, 0, sizeof(efnd));
+ EnumFontFamiliesExA(dc, &font, enum_fullname_data_proc, (LPARAM)&efnd, 0);
+ todo_wine
+ ok(efnd.total == 2, "EnumFontFamiliesExA found %d fonts, expected 2.\n", efnd.total);
+
+ strcpy(font.lfFaceName, "Wine TTF Names Long Family1 Con");
+ memset(&efnd, 0, sizeof(efnd));
+ EnumFontFamiliesExA(dc, &font, enum_fullname_data_proc, (LPARAM)&efnd, 0);
+ todo_wine
+ ok(efnd.total == 2, "EnumFontFamiliesExA found %d fonts, expected 2.\n", efnd.total);
+
+ handle_font = CreateFontIndirectA(&font);
+ ok(handle_font != NULL, "CreateFontIndirectA failed\n");
+ DeleteObject(handle_font);
+
+ ret = RemoveFontResourceExA(ttf_name_bold, FR_PRIVATE, 0);
+ todo_wine
+ ok(ret, "RemoveFontResourceEx() failed\n");
+
+ DeleteFileA(ttf_name_bold);
+
+ ret = RemoveFontResourceExA(ttf_name, FR_PRIVATE, 0);
+ ok(ret, "RemoveFontResourceEx() failed\n");
+
+ DeleteFileA(ttf_name);
+ ReleaseDC(NULL, dc);
+}
+
typedef struct
{
USHORT majorVersion;
@@ -7351,6 +7421,7 @@ START_TEST(font)
test_bitmap_font_glyph_index();
test_GetCharWidthI();
test_long_names();
+ test_ttf_names();
test_char_width();
/* These tests should be last test until RemoveFontResource
diff --git a/dlls/gdi32/tests/resource.rc b/dlls/gdi32/tests/resource.rc
index 6dcbd42ab5..b5a6107a98 100644
--- a/dlls/gdi32/tests/resource.rc
+++ b/dlls/gdi32/tests/resource.rc
@@ -31,3 +31,9 @@ vertical.ttf RCDATA vertical.ttf
/* @makedep: wine_longname.ttf */
wine_longname.ttf RCDATA wine_longname.ttf
+
+/* @makedep: wine_ttfnames.ttf */
+wine_ttfnames.ttf RCDATA wine_ttfnames.ttf
+
+/* @makedep: wine_ttfnames_bold.ttf */
+wine_ttfnames_bold.ttf RCDATA wine_ttfnames_bold.ttf
diff --git a/dlls/gdi32/tests/wine_ttfnames.sfd b/dlls/gdi32/tests/wine_ttfnames.sfd
new file mode 100644
index 0000000000..566749d19a
--- /dev/null
+++ b/dlls/gdi32/tests/wine_ttfnames.sfd
@@ -0,0 +1,85 @@
+SplineFontDB: 3.2
+FontName: Wine_TTF_Names_Long_Family1_Cond_Regular
+FamilyName: Wine_TTF_Names_Long_Family1_Cond
+Weight: Regular
+Copyright: Copyright (c) 2020, Remi Bernon for CodeWeavers
+UComments: "2017-11-17: Created with FontForge (http://fontforge.org)"
+Version: 001.000
+ItalicAngle: 0
+UnderlinePosition: -102
+UnderlineWidth: 51
+Ascent: 819
+Descent: 205
+InvalidEm: 0
+LayerCount: 2
+Layer: 0 0 "Back" 1
+Layer: 1 0 "Fore" 0
+XUID: [1021 48 28337276 3092883]
+OS2Version: 0
+OS2_WeightWidthSlopeOnly: 0
+OS2_UseTypoMetrics: 1
+CreationTime: 1510948643
+ModificationTime: 1598865292
+OS2TypoAscent: 0
+OS2TypoAOffset: 1
+OS2TypoDescent: 0
+OS2TypoDOffset: 1
+OS2TypoLinegap: 0
+OS2WinAscent: 0
+OS2WinAOffset: 1
+OS2WinDescent: 0
+OS2WinDOffset: 1
+HheadAscent: 0
+HheadAOffset: 1
+HheadDescent: 0
+HheadDOffset: 1
+OS2Vendor: 'PfEd'
+MarkAttachClasses: 1
+DEI: 91125
+LangName: 1033 \
+ "" \
+ "Wine TTF Names Long Family1 Cond" \
+ "Regular" \
+ "" \
+ "Wine TTF Names Long Family1 Extremely Long Full Name Condensed" \
+ "" \
+ "" \
+ "" \
+ "" \
+ "" \
+ "" \
+ "" \
+ "" \
+ "" \
+ "" \
+ "" \
+ "Wine TTF Names Long Family1" \
+ "Condensed Regular" \
+
+Encoding: ISO8859-1
+UnicodeInterp: none
+NameList: AGL For New Fonts
+DisplaySize: -48
+AntiAlias: 1
+FitToEm: 0
+WinInfo: 64 16 4
+BeginPrivate: 0
+EndPrivate
+BeginChars: 256 1
+
+StartChar: at
+Encoding: 64 64 0
+Width: 1024
+VWidth: 0
+Flags: HW
+LayerCount: 2
+Fore
+SplineSet
+259 332 m 29
+ 468 664 l 29
+ 514 332 l 29
+ 259 332 l 29
+EndSplineSet
+EndChar
+EndChars
+EndSplineFont
diff --git a/dlls/gdi32/tests/wine_ttfnames.ttf b/dlls/gdi32/tests/wine_ttfnames.ttf
new file mode 100644
index 0000000000..2eb2ad1f95
Binary files /dev/null and b/dlls/gdi32/tests/wine_ttfnames.ttf differ
diff --git a/dlls/gdi32/tests/wine_ttfnames_bold.sfd b/dlls/gdi32/tests/wine_ttfnames_bold.sfd
new file mode 100644
index 0000000000..b3bf4ddfe9
--- /dev/null
+++ b/dlls/gdi32/tests/wine_ttfnames_bold.sfd
@@ -0,0 +1,85 @@
+SplineFontDB: 3.2
+FontName: Wine_TTF_Names_Long_Family1_Cond_Regular
+FamilyName: Wine_TTF_Names_Long_Family1_Cond
+Weight: Regular
+Copyright: Copyright (c) 2020, Remi Bernon for CodeWeavers
+UComments: "2017-11-17: Created with FontForge (http://fontforge.org)"
+Version: 001.000
+ItalicAngle: 0
+UnderlinePosition: -102
+UnderlineWidth: 51
+Ascent: 819
+Descent: 205
+InvalidEm: 0
+LayerCount: 2
+Layer: 0 0 "Back" 1
+Layer: 1 0 "Fore" 0
+XUID: [1021 48 28337276 3092883]
+OS2Version: 0
+OS2_WeightWidthSlopeOnly: 0
+OS2_UseTypoMetrics: 1
+CreationTime: 1510948643
+ModificationTime: 1598865292
+OS2TypoAscent: 0
+OS2TypoAOffset: 1
+OS2TypoDescent: 0
+OS2TypoDOffset: 1
+OS2TypoLinegap: 0
+OS2WinAscent: 0
+OS2WinAOffset: 1
+OS2WinDescent: 0
+OS2WinDOffset: 1
+HheadAscent: 0
+HheadAOffset: 1
+HheadDescent: 0
+HheadDOffset: 1
+OS2Vendor: 'PfEd'
+MarkAttachClasses: 1
+DEI: 91125
+LangName: 1033 \
+ "" \
+ "Wine TTF Names Long Family1 CondBold" \
+ "Regular" \
+ "" \
+ "Wine TTF Names Long Family1 Extremely Long Full Name Condensed Bold" \
+ "" \
+ "" \
+ "" \
+ "" \
+ "" \
+ "" \
+ "" \
+ "" \
+ "" \
+ "" \
+ "" \
+ "Wine TTF Names Long Family1" \
+ "Condensed Bold Regular" \
+
+Encoding: ISO8859-1
+UnicodeInterp: none
+NameList: AGL For New Fonts
+DisplaySize: -48
+AntiAlias: 1
+FitToEm: 0
+WinInfo: 64 16 4
+BeginPrivate: 0
+EndPrivate
+BeginChars: 256 1
+
+StartChar: at
+Encoding: 64 64 0
+Width: 1024
+VWidth: 0
+Flags: HW
+LayerCount: 2
+Fore
+SplineSet
+259 332 m 29
+ 468 664 l 29
+ 514 332 l 29
+ 259 332 l 29
+EndSplineSet
+EndChar
+EndChars
+EndSplineFont
diff --git a/dlls/gdi32/tests/wine_ttfnames_bold.ttf b/dlls/gdi32/tests/wine_ttfnames_bold.ttf
new file mode 100644
index 0000000000..919a5ea131
Binary files /dev/null and b/dlls/gdi32/tests/wine_ttfnames_bold.ttf differ
More information about the wine-cvs
mailing list