[PATCH 5/6] dwrite: Support at least some Latin fallback fonts.

Giovanni Mascellani gmascellani at codeweavers.com
Mon Mar 8 03:31:18 CST 2021


Signed-off-by: Giovanni Mascellani <gmascellani at codeweavers.com>
---
 dlls/dwrite/analyzer.c     | 16 ++++++++++++++++
 dlls/dwrite/tests/layout.c |  9 ---------
 2 files changed, 16 insertions(+), 9 deletions(-)

diff --git a/dlls/dwrite/analyzer.c b/dlls/dwrite/analyzer.c
index e4bc8d42943..daa553adbaf 100644
--- a/dlls/dwrite/analyzer.c
+++ b/dlls/dwrite/analyzer.c
@@ -220,6 +220,21 @@ static const DWRITE_UNICODE_RANGE cjk_ranges[] =
     { 0x4e00, 0x9fff }, /* CJK Unified Ideographs */
 };
 
+static const WCHAR timesW[] = {'T','i','m','e','s',' ','N','e','w',' ','R','o','m','a','n',0};
+static const WCHAR liberationW[] = {'L','i','b','e','r','a','t','i','o','n',' ','S','e','r','i','f',0};
+static const WCHAR dejavuW[] = {'D','e','j','a','V','u',' ','S','e','r','i','f',0};
+
+static const WCHAR *latin_families[] = { timesW, liberationW, dejavuW };
+
+static const DWRITE_UNICODE_RANGE latin_ranges[] =
+{
+    { 0x0000, 0x05ff },
+    { 0x1d00, 0x2eff },
+    { 0xa700, 0xa7ff },
+    { 0xfb00, 0xfb4f },
+    { 0xfe20, 0xfe23 },
+};
+
 struct fallback_mapping {
     DWRITE_UNICODE_RANGE *ranges;
     UINT32 ranges_count;
@@ -236,6 +251,7 @@ static const struct fallback_mapping fontfallback_neutral_data[] = {
           (WCHAR **)families, ARRAY_SIZE(families) }
 
     MAPPING_RANGE(cjk_ranges, cjk_families),
+    MAPPING_RANGE(latin_ranges, latin_families),
 
 #undef MAPPING_RANGE
 };
diff --git a/dlls/dwrite/tests/layout.c b/dlls/dwrite/tests/layout.c
index 9feb9e224fc..8574af5465f 100644
--- a/dlls/dwrite/tests/layout.c
+++ b/dlls/dwrite/tests/layout.c
@@ -4645,12 +4645,9 @@ static void test_MapCharacters(void)
     font = NULL;
     hr = IDWriteFontFallback_MapCharacters(fallback, &analysissource, 0, 1, NULL, NULL, DWRITE_FONT_WEIGHT_NORMAL,
         DWRITE_FONT_STYLE_NORMAL, DWRITE_FONT_STRETCH_NORMAL, &mappedlength, &font, &scale);
-todo_wine {
     ok(hr == S_OK, "got 0x%08x\n", hr);
     ok(mappedlength == 1, "got %u\n", mappedlength);
-}
     ok(scale == 1.0f, "got %f\n", scale);
-todo_wine
     ok(font != NULL, "got %p\n", font);
 if (font) {
     IDWriteFont_Release(font);
@@ -4662,12 +4659,9 @@ if (font) {
     font = NULL;
     hr = IDWriteFontFallback_MapCharacters(fallback, &analysissource, 0, 3, NULL, NULL, DWRITE_FONT_WEIGHT_NORMAL,
         DWRITE_FONT_STYLE_NORMAL, DWRITE_FONT_STRETCH_NORMAL, &mappedlength, &font, &scale);
-todo_wine {
     ok(hr == S_OK, "got 0x%08x\n", hr);
     ok(mappedlength == 3, "got %u\n", mappedlength);
-}
     ok(scale == 1.0f, "got %f\n", scale);
-todo_wine
     ok(font != NULL, "got %p\n", font);
 if (font) {
     IDWriteFont_Release(font);
@@ -4679,12 +4673,9 @@ if (font) {
     font = NULL;
     hr = IDWriteFontFallback_MapCharacters(fallback, &analysissource, 0, 4, NULL, NULL, DWRITE_FONT_WEIGHT_NORMAL,
         DWRITE_FONT_STYLE_NORMAL, DWRITE_FONT_STRETCH_NORMAL, &mappedlength, &font, &scale);
-todo_wine {
     ok(hr == S_OK, "got 0x%08x\n", hr);
     ok(mappedlength == 1, "got %u\n", mappedlength);
-}
     ok(scale == 1.0f, "got %f\n", scale);
-todo_wine
     ok(font != NULL, "got %p\n", font);
 if (font) {
     IDWriteFont_Release(font);
-- 
2.30.1




More information about the wine-devel mailing list