mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2024-11-21 16:46:54 -08:00
89 lines
3.4 KiB
Diff
89 lines
3.4 KiB
Diff
From 3f165554d6ca5dc9a1606794d9b0824796714c03 Mon Sep 17 00:00:00 2001
|
|
From: Lucian Poston <lucian.poston@gmail.com>
|
|
Date: Fri, 17 Nov 2017 17:28:34 -0800
|
|
Subject: [PATCH 2/2] dwrite: Fix font fallback
|
|
|
|
https://bugs.winehq.org/show_bug.cgi?id=44052
|
|
|
|
Signed-off-by: Lucian Poston <lucian.poston@gmail.com>
|
|
---
|
|
dlls/dwrite/analyzer.c | 15 +++++++++++----
|
|
dlls/dwrite/layout.c | 15 +++++++++++----
|
|
dlls/dwrite/tests/font.c | 1 -
|
|
3 files changed, 22 insertions(+), 9 deletions(-)
|
|
|
|
diff --git a/dlls/dwrite/analyzer.c b/dlls/dwrite/analyzer.c
|
|
index 8d553c6..1659b56 100644
|
|
--- a/dlls/dwrite/analyzer.c
|
|
+++ b/dlls/dwrite/analyzer.c
|
|
@@ -2139,15 +2139,22 @@ static HRESULT WINAPI fontfallback_MapCharacters(IDWriteFontFallback *iface, IDW
|
|
if (length == 0)
|
|
return S_OK;
|
|
|
|
- if (!basecollection)
|
|
- basecollection = (IDWriteFontCollection*)fallback->systemcollection;
|
|
-
|
|
hr = get_text_source_ptr(source, position, length, &text, &buff);
|
|
if (FAILED(hr))
|
|
goto done;
|
|
|
|
if (basefamily && *basefamily) {
|
|
- hr = create_matching_font(basecollection, basefamily, weight, style, stretch, ret_font);
|
|
+ if (basecollection)
|
|
+ {
|
|
+ hr = create_matching_font(basecollection, basefamily, weight, style, stretch, ret_font);
|
|
+ }
|
|
+
|
|
+ if (!basecollection || FAILED(hr))
|
|
+ {
|
|
+ hr = create_matching_font((IDWriteFontCollection*)fallback->systemcollection,
|
|
+ basefamily, weight, style, stretch, ret_font);
|
|
+ }
|
|
+
|
|
if (FAILED(hr))
|
|
goto done;
|
|
|
|
diff --git a/dlls/dwrite/layout.c b/dlls/dwrite/layout.c
|
|
index 104b039..fefe14c 100644
|
|
--- a/dlls/dwrite/layout.c
|
|
+++ b/dlls/dwrite/layout.c
|
|
@@ -830,12 +830,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;
|
|
+ if (range->collection) {
|
|
+ hr = create_matching_font(range->collection, range->fontfamily,
|
|
+ range->weight, range->style, range->stretch, &font);
|
|
+ }
|
|
|
|
- collection = range->collection ? range->collection : sys_collection;
|
|
+ if (range->collection == NULL || FAILED(hr))
|
|
+ {
|
|
+ hr = create_matching_font(sys_collection, range->fontfamily,
|
|
+ range->weight, range->style, range->stretch, &font);
|
|
+ }
|
|
|
|
- if (FAILED(hr = create_matching_font(collection, range->fontfamily, range->weight, range->style,
|
|
- range->stretch, &font))) {
|
|
+ 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/font.c b/dlls/dwrite/tests/font.c
|
|
index ae386e6..cf0856f 100644
|
|
--- a/dlls/dwrite/tests/font.c
|
|
+++ b/dlls/dwrite/tests/font.c
|
|
@@ -2958,7 +2958,6 @@ static void test_CustomFontCollection_fallback(void)
|
|
ok(hr == S_OK, "got 0x%08x\n", hr);
|
|
|
|
hr = IDWriteTextLayout_GetMetrics(layout, &metrics);
|
|
- todo_wine
|
|
ok(hr == S_OK, "got 0x%08x\n", hr);
|
|
|
|
hr = IDWriteFactory_UnregisterFontCollectionLoader(factory, loader);
|
|
--
|
|
1.9.1
|
|
|