From 19c062dbc79b6a24753dfd5002e5d285e0330661 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Wed, 14 Sep 2022 10:34:47 -0500 Subject: [PATCH] dwrite-FontFallback: Remove remaining patches. Per Nikolay, these are upstream now. They would appear to be obviated by a10ae49292 and b783100773. --- ...Characters-for-non-visual-characters.patch | 128 ------------------ ...MapCharacters-for-dummy-line-metrics.patch | 96 ------------- patches/dwrite-FontFallback/definition | 2 - 3 files changed, 226 deletions(-) delete mode 100644 patches/dwrite-FontFallback/0005-dwrite-Use-MapCharacters-for-non-visual-characters.patch delete mode 100644 patches/dwrite-FontFallback/0006-dwrite-Use-MapCharacters-for-dummy-line-metrics.patch delete mode 100644 patches/dwrite-FontFallback/definition diff --git a/patches/dwrite-FontFallback/0005-dwrite-Use-MapCharacters-for-non-visual-characters.patch b/patches/dwrite-FontFallback/0005-dwrite-Use-MapCharacters-for-non-visual-characters.patch deleted file mode 100644 index c305f465..00000000 --- a/patches/dwrite-FontFallback/0005-dwrite-Use-MapCharacters-for-non-visual-characters.patch +++ /dev/null @@ -1,128 +0,0 @@ -From 838b8a5edeca6c06c20bdc301f4d5d658e835cc9 Mon Sep 17 00:00:00 2001 -From: Lucian Poston -Date: Wed, 23 May 2018 05:59:20 -0700 -Subject: [PATCH 5/6] dwrite: Use MapCharacters for non-visual characters - -Signed-off-by: Lucian Poston ---- - dlls/dwrite/layout.c | 22 +++++++++++++++------- - dlls/dwrite/tests/layout.c | 24 ------------------------ - 2 files changed, 15 insertions(+), 31 deletions(-) - -diff --git a/dlls/dwrite/layout.c b/dlls/dwrite/layout.c -index df3f3beabb..5d06bf9348 100644 ---- a/dlls/dwrite/layout.c -+++ b/dlls/dwrite/layout.c -@@ -822,7 +822,8 @@ static HRESULT layout_resolve_fonts(struct dwrite_textlayout *layout) - LIST_FOR_EACH_ENTRY(r, &layout->runs, struct layout_run, entry) { - struct regular_layout_run *run = &r->u.regular; - IDWriteFont *font; -- UINT32 length; -+ UINT32 length, mapped_length; -+ FLOAT scale; - - if (r->kind == LAYOUT_RUN_INLINE) - continue; -@@ -830,12 +831,19 @@ static HRESULT layout_resolve_fonts(struct dwrite_textlayout *layout) - range = get_layout_range_by_pos(layout, run->descr.textPosition); - - if (run->sa.shapes == DWRITE_SCRIPT_SHAPES_NO_VISUAL) { -- IDWriteFontCollection *collection; -- -- collection = range->collection ? range->collection : sys_collection; -- -- if (FAILED(hr = create_matching_font(collection, range->fontfamily, range->weight, range->style, -- range->stretch, &font))) { -+ hr = IDWriteFontFallback_MapCharacters(fallback, -+ (IDWriteTextAnalysisSource *)&layout->IDWriteTextAnalysisSource1_iface, -+ run->descr.textPosition, -+ run->descr.stringLength, -+ range->collection, -+ range->fontfamily, -+ range->weight, -+ range->style, -+ range->stretch, -+ &mapped_length, -+ &font, -+ &scale); -+ if (FAILED(hr)) { - WARN("%s: failed to create matching font for non visual run, family %s, collection %p\n", - debugstr_rundescr(&run->descr), debugstr_w(range->fontfamily), range->collection); - break; -diff --git a/dlls/dwrite/tests/layout.c b/dlls/dwrite/tests/layout.c -index 430bb1f0eb..cf1d5d7060 100644 ---- a/dlls/dwrite/tests/layout.c -+++ b/dlls/dwrite/tests/layout.c -@@ -5713,34 +5713,22 @@ static void test_GetMetrics_with_custom_fontcollection(void) - ok(hr == S_OK, "got 0x%08x\n", hr); - count = 9999; - hr = IDWriteTextLayout_GetClusterMetrics(layout, clusters, 4, &count); -- todo_wine - ok(hr == S_OK, "got 0x%08x\n", hr); -- todo_wine - ok(count == 4, "got %u\n", count); - for (i = 0, width = 0.0; i < count; i++) - width += clusters[i].width; - memset(&metrics, 0xcc, sizeof(metrics)); - hr = IDWriteTextLayout_GetMetrics(layout, &metrics); -- todo_wine - ok(hr == S_OK, "got 0x%08x\n", hr); -- todo_wine - ok(metrics.left == 0.0, "got %.2f\n", metrics.left); -- todo_wine - ok(metrics.top == 0.0, "got %.2f\n", metrics.top); -- todo_wine - ok(metrics.width == width, "got %.2f, expected %.2f\n", metrics.width, width); -- todo_wine - ok(metrics.widthIncludingTrailingWhitespace == width, "got %.2f, expected %.2f\n", - metrics.widthIncludingTrailingWhitespace, width); -- todo_wine - ok(metrics.height > 0.0, "got %.2f\n", metrics.height); -- todo_wine - ok(metrics.layoutWidth == 1000.0, "got %.2f\n", metrics.layoutWidth); -- todo_wine - ok(metrics.layoutHeight == 1000.0, "got %.2f\n", metrics.layoutHeight); -- todo_wine - ok(metrics.maxBidiReorderingDepth == 1, "got %u\n", metrics.maxBidiReorderingDepth); -- todo_wine - ok(metrics.lineCount == 1, "got %u\n", metrics.lineCount); - IDWriteTextLayout_Release(layout); - -@@ -5749,34 +5737,22 @@ static void test_GetMetrics_with_custom_fontcollection(void) - ok(hr == S_OK, "got 0x%08x\n", hr); - count = 9999; - hr = IDWriteTextLayout_GetClusterMetrics(layout, clusters, 4, &count); -- todo_wine - ok(hr == S_OK, "got 0x%08x\n", hr); -- todo_wine - ok(count == 4, "got %u\n", count); - for (i = 0, width = 0.0; i < count; i++) - width += clusters[i].width; - memset(&metrics, 0xcc, sizeof(metrics)); - hr = IDWriteTextLayout_GetMetrics(layout, &metrics); -- todo_wine - ok(hr == S_OK, "got 0x%08x\n", hr); -- todo_wine - ok(metrics.left == 0.0, "got %.2f\n", metrics.left); -- todo_wine - ok(metrics.top == 0.0, "got %.2f\n", metrics.top); -- todo_wine - ok(metrics.width == width, "got %.2f, expected %.2f\n", metrics.width, width); -- todo_wine - ok(metrics.widthIncludingTrailingWhitespace == width, "got %.2f, expected %.2f\n", - metrics.widthIncludingTrailingWhitespace, width); -- todo_wine - ok(metrics.height > 0.0, "got %.2f\n", metrics.height); -- todo_wine - ok(metrics.layoutWidth == 1000.0, "got %.2f\n", metrics.layoutWidth); -- todo_wine - ok(metrics.layoutHeight == 1000.0, "got %.2f\n", metrics.layoutHeight); -- todo_wine - ok(metrics.maxBidiReorderingDepth == 1, "got %u\n", metrics.maxBidiReorderingDepth); -- todo_wine - ok(metrics.lineCount == 1, "got %u\n", metrics.lineCount); - IDWriteTextLayout_Release(layout); - --- -2.18.0 - diff --git a/patches/dwrite-FontFallback/0006-dwrite-Use-MapCharacters-for-dummy-line-metrics.patch b/patches/dwrite-FontFallback/0006-dwrite-Use-MapCharacters-for-dummy-line-metrics.patch deleted file mode 100644 index d2d3d4ac..00000000 --- a/patches/dwrite-FontFallback/0006-dwrite-Use-MapCharacters-for-dummy-line-metrics.patch +++ /dev/null @@ -1,96 +0,0 @@ -From a0f4bde380003f7a8e3b713028215bf985dbb3c0 Mon Sep 17 00:00:00 2001 -From: Lucian Poston -Date: Wed, 23 May 2018 07:03:44 -0700 -Subject: [PATCH 6/6] dwrite: Use MapCharacters for dummy line metrics - -Fixes: https://bugs.winehq.org/show_bug.cgi?id=44052 - -Signed-off-by: Lucian Poston ---- - dlls/dwrite/layout.c | 29 +++++++++++++++++++++++++++++ - dlls/dwrite/tests/layout.c | 8 -------- - 2 files changed, 29 insertions(+), 8 deletions(-) - -diff --git a/dlls/dwrite/layout.c b/dlls/dwrite/layout.c -index 5d06bf9348..2213717f92 100644 ---- a/dlls/dwrite/layout.c -+++ b/dlls/dwrite/layout.c -@@ -1808,8 +1808,11 @@ static HRESULT layout_set_dummy_line_metrics(struct dwrite_textlayout *layout, U - DWRITE_FONT_METRICS fontmetrics; - struct layout_range *range; - IDWriteFontFace *fontface; -+ IDWriteFontFallback *fallback; - IDWriteFont *font; - HRESULT hr; -+ UINT32 mapped_length; -+ FLOAT scale; - - range = get_layout_range_by_pos(layout, pos); - hr = create_matching_font(range->collection, -@@ -1818,8 +1821,34 @@ static HRESULT layout_set_dummy_line_metrics(struct dwrite_textlayout *layout, U - range->style, - range->stretch, - &font); -+ -+ if (FAILED(hr)) { -+ if (layout->format.fallback) { -+ fallback = layout->format.fallback; -+ IDWriteFontFallback_AddRef(fallback); -+ } else if (FAILED(hr = IDWriteFactory7_GetSystemFontFallback(layout->factory, &fallback))) { -+ WARN("Failed to get system fallback, hr %#x.\n", hr); -+ return hr; -+ } -+ -+ hr = IDWriteFontFallback_MapCharacters(fallback, -+ (IDWriteTextAnalysisSource *)&layout->IDWriteTextAnalysisSource1_iface, -+ pos, -+ layout->len, -+ range->collection, -+ range->fontfamily, -+ range->weight, -+ range->style, -+ range->stretch, -+ &mapped_length, -+ &font, -+ &scale); -+ IDWriteFontFallback_Release(fallback); -+ } - if (FAILED(hr)) - return hr; -+ if (font == NULL) -+ return S_OK; - hr = IDWriteFont_CreateFontFace(font, &fontface); - IDWriteFont_Release(font); - if (FAILED(hr)) -diff --git a/dlls/dwrite/tests/layout.c b/dlls/dwrite/tests/layout.c -index cf1d5d7060..6ed7b3c334 100644 ---- a/dlls/dwrite/tests/layout.c -+++ b/dlls/dwrite/tests/layout.c -@@ -5767,24 +5767,16 @@ static void test_GetMetrics_with_custom_fontcollection(void) - width += clusters[i].width; - memset(&metrics, 0xcc, sizeof(metrics)); - hr = IDWriteTextLayout_GetMetrics(layout, &metrics); -- todo_wine - ok(hr == S_OK, "got 0x%08x\n", hr); -- todo_wine - ok(metrics.left == 0.0, "got %.2f\n", metrics.left); -- todo_wine - ok(metrics.top == 0.0, "got %.2f\n", metrics.top); -- todo_wine - ok(metrics.width == width, "got %.2f, expected %.2f\n", metrics.width, width); -- todo_wine - ok(metrics.widthIncludingTrailingWhitespace == width, "got %.2f, expected %.2f\n", - metrics.widthIncludingTrailingWhitespace, width); - todo_wine - ok(metrics.height > 0.0, "got %.2f\n", metrics.height); -- todo_wine - ok(metrics.layoutWidth == 1000.0, "got %.2f\n", metrics.layoutWidth); -- todo_wine - ok(metrics.layoutHeight == 1000.0, "got %.2f\n", metrics.layoutHeight); -- todo_wine - ok(metrics.maxBidiReorderingDepth == 1, "got %u\n", metrics.maxBidiReorderingDepth); - todo_wine - ok(metrics.lineCount == 1, "got %u\n", metrics.lineCount); --- -2.18.0 - diff --git a/patches/dwrite-FontFallback/definition b/patches/dwrite-FontFallback/definition deleted file mode 100644 index 3504d64b..00000000 --- a/patches/dwrite-FontFallback/definition +++ /dev/null @@ -1,2 +0,0 @@ -Fixes: [44052] - Support for font fallback. -Disabled: True