Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
c3252c37
Commit
c3252c37
authored
Sep 21, 2017
by
Nikolay Sivov
Committed by
Alexandre Julliard
Sep 21, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dwrite: Added custom IDWriteFontFallback stub.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
ca13227e
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
94 additions
and
19 deletions
+94
-19
analyzer.c
dlls/dwrite/analyzer.c
+61
-3
layout.c
dlls/dwrite/tests/layout.c
+33
-16
No files found.
dlls/dwrite/analyzer.c
View file @
c3252c37
...
...
@@ -209,6 +209,7 @@ static const struct fallback_mapping fontfallback_neutral_data[] = {
struct
dwrite_fontfallback
{
IDWriteFontFallback
IDWriteFontFallback_iface
;
LONG
ref
;
IDWriteFactory5
*
factory
;
IDWriteFontCollection1
*
systemcollection
;
const
struct
fallback_mapping
*
mappings
;
...
...
@@ -2178,6 +2179,50 @@ void release_system_fontfallback(IDWriteFontFallback *iface)
heap_free
(
fallback
);
}
static
ULONG
WINAPI
customfontfallback_AddRef
(
IDWriteFontFallback
*
iface
)
{
struct
dwrite_fontfallback
*
fallback
=
impl_from_IDWriteFontFallback
(
iface
);
ULONG
ref
=
InterlockedIncrement
(
&
fallback
->
ref
);
TRACE
(
"(%p)->(%d)
\n
"
,
fallback
,
ref
);
return
ref
;
}
static
ULONG
WINAPI
customfontfallback_Release
(
IDWriteFontFallback
*
iface
)
{
struct
dwrite_fontfallback
*
fallback
=
impl_from_IDWriteFontFallback
(
iface
);
ULONG
ref
=
InterlockedDecrement
(
&
fallback
->
ref
);
TRACE
(
"(%p)->(%d)
\n
"
,
fallback
,
ref
);
if
(
!
ref
)
{
IDWriteFactory5_Release
(
fallback
->
factory
);
heap_free
(
fallback
);
}
return
ref
;
}
static
HRESULT
WINAPI
customfontfallback_MapCharacters
(
IDWriteFontFallback
*
iface
,
IDWriteTextAnalysisSource
*
source
,
UINT32
position
,
UINT32
length
,
IDWriteFontCollection
*
basecollection
,
const
WCHAR
*
basefamily
,
DWRITE_FONT_WEIGHT
weight
,
DWRITE_FONT_STYLE
style
,
DWRITE_FONT_STRETCH
stretch
,
UINT32
*
mapped_length
,
IDWriteFont
**
ret_font
,
FLOAT
*
scale
)
{
struct
dwrite_fontfallback
*
fallback
=
impl_from_IDWriteFontFallback
(
iface
);
FIXME
(
"(%p)->(%p %u %u %p, %s, %u, %u, %u, %p, %p, %p)
\n
"
,
fallback
,
source
,
position
,
length
,
basecollection
,
debugstr_w
(
basefamily
),
weight
,
style
,
stretch
,
mapped_length
,
ret_font
,
scale
);
return
E_NOTIMPL
;
}
static
const
IDWriteFontFallbackVtbl
customfontfallbackvtbl
=
{
fontfallback_QueryInterface
,
customfontfallback_AddRef
,
customfontfallback_Release
,
customfontfallback_MapCharacters
,
};
static
HRESULT
WINAPI
fontfallbackbuilder_QueryInterface
(
IDWriteFontFallbackBuilder
*
iface
,
REFIID
riid
,
void
**
obj
)
{
struct
dwrite_fontfallback_builder
*
fallbackbuilder
=
impl_from_IDWriteFontFallbackBuilder
(
iface
);
...
...
@@ -2239,13 +2284,26 @@ static HRESULT WINAPI fontfallbackbuilder_AddMappings(IDWriteFontFallbackBuilder
}
static
HRESULT
WINAPI
fontfallbackbuilder_CreateFontFallback
(
IDWriteFontFallbackBuilder
*
iface
,
IDWriteFontFallback
**
fallback
)
IDWriteFontFallback
**
ret
)
{
struct
dwrite_fontfallback_builder
*
fallbackbuilder
=
impl_from_IDWriteFontFallbackBuilder
(
iface
);
struct
dwrite_fontfallback
*
fallback
;
FIXME
(
"(%p)->(%p): stub
\n
"
,
fallbackbuilder
,
fallback
);
FIXME
(
"(%p)->(%p): stub
\n
"
,
fallbackbuilder
,
ret
);
return
E_NOTIMPL
;
*
ret
=
NULL
;
fallback
=
heap_alloc
(
sizeof
(
*
fallback
));
if
(
!
fallback
)
return
E_OUTOFMEMORY
;
fallback
->
IDWriteFontFallback_iface
.
lpVtbl
=
&
customfontfallbackvtbl
;
fallback
->
ref
=
1
;
fallback
->
factory
=
fallbackbuilder
->
factory
;
IDWriteFactory5_AddRef
(
fallback
->
factory
);
*
ret
=
&
fallback
->
IDWriteFontFallback_iface
;
return
S_OK
;
}
static
const
IDWriteFontFallbackBuilderVtbl
fontfallbackbuildervtbl
=
...
...
dlls/dwrite/tests/layout.c
View file @
c3252c37
...
...
@@ -4655,8 +4655,8 @@ static void test_FontFallbackBuilder(void)
{
static
const
WCHAR
localeW
[]
=
{
'l'
,
'o'
,
'c'
,
'a'
,
'l'
,
'e'
,
0
};
static
const
WCHAR
strW
[]
=
{
'A'
,
0
};
IDWriteFontFallback
*
fallback
,
*
fallback2
;
IDWriteFontFallbackBuilder
*
builder
;
IDWriteFontFallback
*
fallback
;
DWRITE_UNICODE_RANGE
range
;
IDWriteFactory2
*
factory2
;
IDWriteFactory
*
factory
;
...
...
@@ -4684,10 +4684,27 @@ static void test_FontFallbackBuilder(void)
}
fallback
=
NULL
;
EXPECT_REF
(
factory2
,
2
);
EXPECT_REF
(
builder
,
1
);
hr
=
IDWriteFontFallbackBuilder_CreateFontFallback
(
builder
,
&
fallback
);
todo_wine
{
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
EXPECT_REF
(
factory2
,
3
);
EXPECT_REF
(
fallback
,
1
);
EXPECT_REF
(
builder
,
1
);
IDWriteFontFallback_AddRef
(
fallback
);
EXPECT_REF
(
builder
,
1
);
EXPECT_REF
(
fallback
,
2
);
EXPECT_REF
(
factory2
,
3
);
IDWriteFontFallback_Release
(
fallback
);
/* New instance is created every time, even if mappings have not changed. */
hr
=
IDWriteFontFallbackBuilder_CreateFontFallback
(
builder
,
&
fallback2
);
ok
(
hr
==
S_OK
,
"Failed to create fallback object, hr %#x.
\n
"
,
hr
);
ok
(
fallback
!=
fallback2
,
"Unexpected fallback instance.
\n
"
);
IDWriteFontFallback_Release
(
fallback2
);
todo_wine
{
hr
=
IDWriteFontFallbackBuilder_AddMapping
(
builder
,
NULL
,
0
,
NULL
,
0
,
NULL
,
NULL
,
NULL
,
0
.
0
f
);
ok
(
hr
==
E_INVALIDARG
,
"got 0x%08x
\n
"
,
hr
);
...
...
@@ -4724,17 +4741,14 @@ todo_wine {
hr
=
IDWriteFontFallbackBuilder_AddMapping
(
builder
,
&
range
,
1
,
&
familyW
,
1
,
NULL
,
NULL
,
NULL
,
4
.
0
f
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
}
if
(
fallback
)
IDWriteFontFallback_Release
(
fallback
);
if
(
0
)
/* crashes on native */
hr
=
IDWriteFontFallbackBuilder_CreateFontFallback
(
builder
,
NULL
);
hr
=
IDWriteFontFallbackBuilder_CreateFontFallback
(
builder
,
&
fallback
);
todo_wine
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
if
(
hr
==
S_OK
)
{
/* fallback font missing from system collection */
g_source
=
strW
;
mappedlength
=
0
;
...
...
@@ -4742,13 +4756,14 @@ if (hr == S_OK) {
font
=
(
void
*
)
0xdeadbeef
;
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
.
0
f
,
"got %f
\n
"
,
scale
);
ok
(
font
==
NULL
,
"got %p
\n
"
,
font
);
IDWriteFontFallback_Release
(
fallback
);
}
IDWriteFontFallback_Release
(
fallback
);
/* remap with custom collection */
range
.
first
=
range
.
last
=
'A'
;
hr
=
IDWriteFontFallbackBuilder_AddMapping
(
builder
,
&
range
,
1
,
&
familyW
,
1
,
&
fallbackcollection
,
NULL
,
NULL
,
5
.
0
f
);
...
...
@@ -4756,24 +4771,25 @@ todo_wine
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
hr
=
IDWriteFontFallbackBuilder_CreateFontFallback
(
builder
,
&
fallback
);
todo_wine
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
if
(
hr
==
S_OK
)
{
g_source
=
strW
;
mappedlength
=
0
;
scale
=
0
.
0
f
;
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
==
5
.
0
f
,
"got %f
\n
"
,
scale
);
ok
(
font
!=
NULL
,
"got %p
\n
"
,
font
);
}
if
(
font
)
IDWriteFont_Release
(
font
);
IDWriteFontFallback_Release
(
fallback
);
}
range
.
first
=
'B'
;
range
.
last
=
'A'
;
hr
=
IDWriteFontFallbackBuilder_AddMapping
(
builder
,
&
range
,
1
,
&
familyW
,
1
,
&
fallbackcollection
,
NULL
,
NULL
,
6
.
0
f
);
...
...
@@ -4781,24 +4797,25 @@ todo_wine
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
hr
=
IDWriteFontFallbackBuilder_CreateFontFallback
(
builder
,
&
fallback
);
todo_wine
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
if
(
hr
==
S_OK
)
{
g_source
=
strW
;
mappedlength
=
0
;
scale
=
0
.
0
f
;
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
==
5
.
0
f
,
"got %f
\n
"
,
scale
);
ok
(
font
!=
NULL
,
"got %p
\n
"
,
font
);
}
if
(
font
)
IDWriteFont_Release
(
font
);
IDWriteFontFallback_Release
(
fallback
);
}
/* explicit locale */
range
.
first
=
'A'
;
range
.
last
=
'B'
;
...
...
@@ -4807,24 +4824,24 @@ todo_wine
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
hr
=
IDWriteFontFallbackBuilder_CreateFontFallback
(
builder
,
&
fallback
);
todo_wine
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
if
(
hr
==
S_OK
)
{
g_source
=
strW
;
mappedlength
=
0
;
scale
=
0
.
0
f
;
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
==
5
.
0
f
,
"got %f
\n
"
,
scale
);
ok
(
font
!=
NULL
,
"got %p
\n
"
,
font
);
}
if
(
font
)
IDWriteFont_Release
(
font
);
IDWriteFontFallback_Release
(
fallback
);
}
IDWriteFontFallbackBuilder_Release
(
builder
);
ref
=
IDWriteFactory2_Release
(
factory2
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment