Rebase against 5bccf6fc3f309207ef4162df335157649f627f50.

This commit is contained in:
Zebediah Figura
2021-03-05 21:21:19 -06:00
parent 3a33c70a9a
commit cb2a6e06e1
6 changed files with 89 additions and 125 deletions

View File

@@ -1,4 +1,4 @@
From 593683720fbef744c46cdc9051eb9703d4279819 Mon Sep 17 00:00:00 2001
From cb01601870a6299e0da0a956269ef24ed79d5035 Mon Sep 17 00:00:00 2001
From: Lucian Poston <lucianposton@pm.me>
Date: Mon, 21 May 2018 18:13:00 -0700
Subject: [PATCH] dwrite: Use font fallback when mapping characters
@@ -7,14 +7,14 @@ Signed-off-by: Lucian Poston <lucianposton@pm.me>
---
dlls/dwrite/analyzer.c | 77 +++++++++++++++++++++++++++++---------
dlls/dwrite/layout.c | 6 +++
dlls/dwrite/tests/layout.c | 70 +++++++++-------------------------
3 files changed, 83 insertions(+), 70 deletions(-)
dlls/dwrite/tests/layout.c | 54 +++++---------------------
3 files changed, 74 insertions(+), 63 deletions(-)
diff --git a/dlls/dwrite/analyzer.c b/dlls/dwrite/analyzer.c
index a418081d491..06a3934d229 100644
index 6b74a23540a..5827e87fdf5 100644
--- a/dlls/dwrite/analyzer.c
+++ b/dlls/dwrite/analyzer.c
@@ -2053,6 +2053,7 @@ static HRESULT fallback_get_fallback_font(struct dwrite_fontfallback *fallback,
@@ -2062,6 +2062,7 @@ static HRESULT fallback_get_fallback_font(struct dwrite_fontfallback *fallback,
IDWriteFont **mapped_font)
{
const struct fallback_mapping *mapping;
@@ -22,7 +22,7 @@ index a418081d491..06a3934d229 100644
HRESULT hr;
UINT32 i;
@@ -2064,9 +2065,15 @@ static HRESULT fallback_get_fallback_font(struct dwrite_fontfallback *fallback,
@@ -2073,9 +2074,15 @@ static HRESULT fallback_get_fallback_font(struct dwrite_fontfallback *fallback,
return E_FAIL;
}
@@ -39,7 +39,7 @@ index a418081d491..06a3934d229 100644
weight, style, stretch, mapped_font);
if (hr == S_OK) {
TRACE("Created fallback font using family %s.\n", debugstr_w(mapping->families[i]));
@@ -2123,32 +2130,66 @@ static HRESULT WINAPI fontfallback_MapCharacters(IDWriteFontFallback1 *iface, ID
@@ -2132,32 +2139,66 @@ static HRESULT WINAPI fontfallback_MapCharacters(IDWriteFontFallback1 *iface, ID
if (basefamily && *basefamily) {
hr = create_matching_font(basecollection, basefamily, weight, style, stretch, ret_font);
@@ -124,10 +124,10 @@ index a418081d491..06a3934d229 100644
heap_free(buff);
return hr;
diff --git a/dlls/dwrite/layout.c b/dlls/dwrite/layout.c
index 76ea23ba66b..da1261f3dc8 100644
index 99048b97a3c..64d8eef6f59 100644
--- a/dlls/dwrite/layout.c
+++ b/dlls/dwrite/layout.c
@@ -882,6 +882,12 @@ static HRESULT layout_resolve_fonts(struct dwrite_textlayout *layout)
@@ -958,6 +958,12 @@ static HRESULT layout_resolve_fonts(struct dwrite_textlayout *layout)
goto fatal;
}
@@ -141,10 +141,10 @@ index 76ea23ba66b..da1261f3dc8 100644
IDWriteFont_Release(font);
if (FAILED(hr)) {
diff --git a/dlls/dwrite/tests/layout.c b/dlls/dwrite/tests/layout.c
index 68a6413b2e8..65bbaa71d93 100644
index cea581a0bef..ecefbe9c87a 100644
--- a/dlls/dwrite/tests/layout.c
+++ b/dlls/dwrite/tests/layout.c
@@ -3302,35 +3302,23 @@ todo_wine
@@ -3368,35 +3368,23 @@ todo_wine
count = 0;
hr = IDWriteTextLayout_GetClusterMetrics(layout, clusters, 4, &count);
@@ -180,7 +180,7 @@ index 68a6413b2e8..65bbaa71d93 100644
ok(metrics.lineCount == 1, "got %u\n", metrics.lineCount);
IDWriteTextLayout_Release(layout);
@@ -4624,12 +4612,9 @@ static void test_MapCharacters(void)
@@ -4690,12 +4678,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);
@@ -193,7 +193,7 @@ index 68a6413b2e8..65bbaa71d93 100644
ok(font != NULL, "got %p\n", font);
if (font) {
IDWriteFont_Release(font);
@@ -4641,16 +4626,13 @@ if (font) {
@@ -4707,16 +4692,13 @@ 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);
@@ -213,7 +213,7 @@ index 68a6413b2e8..65bbaa71d93 100644
/* string 'a\x3058b' */
g_source = str2W;
mappedlength = 0;
@@ -4658,38 +4640,32 @@ if (font) {
@@ -4724,32 +4706,24 @@ 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);
@@ -225,11 +225,9 @@ index 68a6413b2e8..65bbaa71d93 100644
-todo_wine
ok(font != NULL, "got %p\n", font);
-if (font) {
- IDWriteFont_Release(font);
IDWriteFont_Release(font);
-}
+ if (font) {
+ IDWriteFont_Release(font);
+ }
+
g_source = str2W;
mappedlength = 0;
scale = 0.0f;
@@ -244,26 +242,13 @@ index 68a6413b2e8..65bbaa71d93 100644
-todo_wine
ok(font != NULL, "got %p\n", font);
-if (font) {
- /* font returned for Hiragana character, check if it supports Latin too */
- exists = FALSE;
- hr = IDWriteFont_HasCharacter(font, 'b', &exists);
- ok(hr == S_OK, "got 0x%08x\n", hr);
- ok(exists, "got %d\n", exists);
+ if (font) {
+ /* font returned for Hiragana character, check if it supports Latin too */
+ exists = FALSE;
+ hr = IDWriteFont_HasCharacter(font, 'b', &exists);
+ ok(hr == S_OK, "got 0x%08x\n", hr);
+ ok(exists, "got %d\n", exists);
- IDWriteFont_Release(font);
IDWriteFont_Release(font);
-}
+ IDWriteFont_Release(font);
+ }
+
/* Try with explicit collection, Tahoma will be forced. */
/* 1. Latin part */
g_source = str2W;
@@ -4712,7 +4688,10 @@ if (font) {
@@ -4772,7 +4746,10 @@ if (font) {
IDWriteLocalizedStrings_Release(strings);
IDWriteFont_Release(font);
@@ -275,7 +260,7 @@ index 68a6413b2e8..65bbaa71d93 100644
g_source = str2W;
mappedlength = 0;
scale = 0.0f;
@@ -4722,7 +4701,6 @@ if (font) {
@@ -4782,7 +4759,6 @@ if (font) {
ok(hr == S_OK, "got 0x%08x\n", hr);
ok(mappedlength == 1, "got %u\n", mappedlength);
ok(scale == 1.0f, "got %f\n", scale);
@@ -283,7 +268,7 @@ index 68a6413b2e8..65bbaa71d93 100644
exists = FALSE;
hr = IDWriteFont_GetInformationalStrings(font, DWRITE_INFORMATIONAL_STRING_WIN32_FAMILY_NAMES, &strings, &exists);
@@ -5916,34 +5894,22 @@ static void test_GetMetrics_with_custom_fontcollection(void)
@@ -6564,34 +6540,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);
@@ -319,5 +304,5 @@ index 68a6413b2e8..65bbaa71d93 100644
IDWriteTextLayout_Release(layout);
--
2.17.1
2.20.1