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
f7f93399
Commit
f7f93399
authored
Dec 09, 2019
by
Nikolay Sivov
Committed by
Alexandre Julliard
Dec 09, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dwrite: Compare axis values when testing for face reference equality.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
ae67aa8b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
75 additions
and
13 deletions
+75
-13
font.c
dlls/dwrite/font.c
+20
-8
font.c
dlls/dwrite/tests/font.c
+55
-5
No files found.
dlls/dwrite/font.c
View file @
f7f93399
...
@@ -236,6 +236,8 @@ struct dwrite_fontfacereference
...
@@ -236,6 +236,8 @@ struct dwrite_fontfacereference
IDWriteFactory7
*
factory
;
IDWriteFactory7
*
factory
;
};
};
static
const
IDWriteFontFaceReference1Vtbl
fontfacereferencevtbl
;
struct
dwrite_fontresource
struct
dwrite_fontresource
{
{
IDWriteFontResource
IDWriteFontResource_iface
;
IDWriteFontResource
IDWriteFontResource_iface
;
...
@@ -1896,6 +1898,16 @@ struct dwrite_fontface *unsafe_impl_from_IDWriteFontFace(IDWriteFontFace *iface)
...
@@ -1896,6 +1898,16 @@ struct dwrite_fontface *unsafe_impl_from_IDWriteFontFace(IDWriteFontFace *iface)
return
CONTAINING_RECORD
(
iface
,
struct
dwrite_fontface
,
IDWriteFontFace5_iface
);
return
CONTAINING_RECORD
(
iface
,
struct
dwrite_fontface
,
IDWriteFontFace5_iface
);
}
}
static
struct
dwrite_fontfacereference
*
unsafe_impl_from_IDWriteFontFaceReference
(
IDWriteFontFaceReference
*
iface
)
{
if
(
!
iface
)
return
NULL
;
if
(
iface
->
lpVtbl
!=
(
IDWriteFontFaceReferenceVtbl
*
)
&
fontfacereferencevtbl
)
return
NULL
;
return
CONTAINING_RECORD
((
IDWriteFontFaceReference1
*
)
iface
,
struct
dwrite_fontfacereference
,
IDWriteFontFaceReference1_iface
);
}
void
get_logfont_from_font
(
IDWriteFont
*
iface
,
LOGFONTW
*
lf
)
void
get_logfont_from_font
(
IDWriteFont
*
iface
,
LOGFONTW
*
lf
)
{
{
struct
dwrite_font
*
font
=
unsafe_impl_from_IDWriteFont
(
iface
);
struct
dwrite_font
*
font
=
unsafe_impl_from_IDWriteFont
(
iface
);
...
@@ -6132,18 +6144,18 @@ static HRESULT WINAPI fontfacereference_CreateFontFaceWithSimulations(IDWriteFon
...
@@ -6132,18 +6144,18 @@ static HRESULT WINAPI fontfacereference_CreateFontFaceWithSimulations(IDWriteFon
static
BOOL
WINAPI
fontfacereference_Equals
(
IDWriteFontFaceReference1
*
iface
,
IDWriteFontFaceReference
*
ref
)
static
BOOL
WINAPI
fontfacereference_Equals
(
IDWriteFontFaceReference1
*
iface
,
IDWriteFontFaceReference
*
ref
)
{
{
struct
dwrite_fontfacereference
*
reference
=
impl_from_IDWriteFontFaceReference1
(
iface
);
struct
dwrite_fontfacereference
*
reference
=
impl_from_IDWriteFontFaceReference1
(
iface
);
IDWriteFontFile
*
file
;
struct
dwrite_fontfacereference
*
other
=
unsafe_impl_from_IDWriteFontFaceReference
(
ref
)
;
BOOL
ret
;
BOOL
ret
;
TRACE
(
"%p, %p.
\n
"
,
iface
,
ref
);
TRACE
(
"%p, %p.
\n
"
,
iface
,
ref
);
if
(
FAILED
(
IDWriteFontFaceReference_GetFontFile
(
ref
,
&
file
)))
ret
=
is_same_fontfile
(
reference
->
file
,
other
->
file
)
&&
reference
->
index
==
other
->
index
&&
return
FALSE
;
reference
->
simulations
==
other
->
simulations
;
if
(
reference
->
axis_values_count
)
ret
=
is_same_fontfile
(
reference
->
file
,
file
)
&&
{
reference
->
index
==
IDWriteFontFaceReference_GetFontFaceIndex
(
ref
)
&&
ret
&=
reference
->
axis_values_count
==
other
->
axis_values_count
&&
reference
->
simulations
==
IDWriteFontFaceReference_GetSimulations
(
ref
);
!
memcmp
(
reference
->
axis_values
,
other
->
axis_values
,
reference
->
axis_values_count
*
sizeof
(
*
reference
->
axis_values
)
);
IDWriteFontFile_Release
(
file
);
}
return
ret
;
return
ret
;
}
}
...
...
dlls/dwrite/tests/font.c
View file @
f7f93399
...
@@ -9279,13 +9279,14 @@ static void test_font_resource(void)
...
@@ -9279,13 +9279,14 @@ static void test_font_resource(void)
IDWriteFontFaceReference1
*
reference
,
*
reference2
;
IDWriteFontFaceReference1
*
reference
,
*
reference2
;
IDWriteFontResource
*
resource
,
*
resource2
;
IDWriteFontResource
*
resource
,
*
resource2
;
IDWriteFontFile
*
fontfile
,
*
fontfile2
;
IDWriteFontFile
*
fontfile
,
*
fontfile2
;
DWRITE_FONT_AXIS_VALUE
axis_value
;
DWRITE_FONT_AXIS_VALUE
axis_value
s
[
2
]
;
IDWriteFontFace5
*
fontface5
;
IDWriteFontFace5
*
fontface5
;
IDWriteFontFace
*
fontface
;
IDWriteFontFace
*
fontface
;
IDWriteFactory6
*
factory
;
IDWriteFactory6
*
factory
;
UINT32
count
,
index
;
UINT32
count
,
index
;
HRESULT
hr
;
HRESULT
hr
;
ULONG
ref
;
ULONG
ref
;
BOOL
ret
;
if
(
!
(
factory
=
create_factory_iid
(
&
IID_IDWriteFactory6
)))
if
(
!
(
factory
=
create_factory_iid
(
&
IID_IDWriteFactory6
)))
{
{
...
@@ -9316,9 +9317,9 @@ static void test_font_resource(void)
...
@@ -9316,9 +9317,9 @@ static void test_font_resource(void)
ok
(
!
index
,
"Unexpected index %u.
\n
"
,
index
);
ok
(
!
index
,
"Unexpected index %u.
\n
"
,
index
);
/* Specify axis value, font has no variations. */
/* Specify axis value, font has no variations. */
axis_value
.
axisTag
=
DWRITE_FONT_AXIS_TAG_WEIGHT
;
axis_value
s
[
0
]
.
axisTag
=
DWRITE_FONT_AXIS_TAG_WEIGHT
;
axis_value
.
value
=
400
.
0
f
;
axis_value
s
[
0
]
.
value
=
400
.
0
f
;
hr
=
IDWriteFontResource_CreateFontFaceReference
(
resource
,
DWRITE_FONT_SIMULATIONS_NONE
,
&
axis_value
,
1
,
&
reference
);
hr
=
IDWriteFontResource_CreateFontFaceReference
(
resource
,
DWRITE_FONT_SIMULATIONS_NONE
,
axis_values
,
1
,
&
reference
);
ok
(
hr
==
S_OK
,
"Failed to create reference object, hr %#x.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Failed to create reference object, hr %#x.
\n
"
,
hr
);
count
=
IDWriteFontFaceReference1_GetFontAxisValueCount
(
reference
);
count
=
IDWriteFontFaceReference1_GetFontAxisValueCount
(
reference
);
...
@@ -9326,7 +9327,7 @@ static void test_font_resource(void)
...
@@ -9326,7 +9327,7 @@ static void test_font_resource(void)
IDWriteFontFaceReference1_Release
(
reference
);
IDWriteFontFaceReference1_Release
(
reference
);
hr
=
IDWriteFactory6_CreateFontFaceReference
(
factory
,
fontfile
,
0
,
DWRITE_FONT_SIMULATIONS_NONE
,
&
axis_value
,
1
,
hr
=
IDWriteFactory6_CreateFontFaceReference
(
factory
,
fontfile
,
0
,
DWRITE_FONT_SIMULATIONS_NONE
,
axis_values
,
1
,
&
reference
);
&
reference
);
count
=
IDWriteFontFaceReference1_GetFontAxisValueCount
(
reference
);
count
=
IDWriteFontFaceReference1_GetFontAxisValueCount
(
reference
);
ok
(
count
==
1
,
"Unexpected axis value count.
\n
"
);
ok
(
count
==
1
,
"Unexpected axis value count.
\n
"
);
...
@@ -9360,6 +9361,55 @@ static void test_font_resource(void)
...
@@ -9360,6 +9361,55 @@ static void test_font_resource(void)
IDWriteFontFace5_Release
(
fontface5
);
IDWriteFontFace5_Release
(
fontface5
);
/* Reference equality regarding set axis values. */
axis_values
[
0
].
axisTag
=
DWRITE_FONT_AXIS_TAG_WEIGHT
;
axis_values
[
0
].
value
=
400
.
0
f
;
axis_values
[
1
].
axisTag
=
DWRITE_FONT_AXIS_TAG_ITALIC
;
axis_values
[
1
].
value
=
1
.
0
f
;
hr
=
IDWriteFactory6_CreateFontFaceReference
(
factory
,
fontfile
,
0
,
DWRITE_FONT_SIMULATIONS_NONE
,
axis_values
,
2
,
&
reference
);
count
=
IDWriteFontFaceReference1_GetFontAxisValueCount
(
reference
);
ok
(
count
==
2
,
"Unexpected axis value count.
\n
"
);
hr
=
IDWriteFactory6_CreateFontFaceReference
(
factory
,
fontfile
,
0
,
DWRITE_FONT_SIMULATIONS_NONE
,
NULL
,
0
,
&
reference2
);
count
=
IDWriteFontFaceReference1_GetFontAxisValueCount
(
reference2
);
ok
(
!
count
,
"Unexpected axis value count.
\n
"
);
ret
=
IDWriteFontFaceReference1_Equals
(
reference
,
(
IDWriteFontFaceReference
*
)
reference2
);
ok
(
!
ret
,
"Unexpected result.
\n
"
);
IDWriteFontFaceReference1_Release
(
reference2
);
/* Different values order. */
axis_values
[
0
].
axisTag
=
DWRITE_FONT_AXIS_TAG_ITALIC
;
axis_values
[
0
].
value
=
1
.
0
f
;
axis_values
[
1
].
axisTag
=
DWRITE_FONT_AXIS_TAG_WEIGHT
;
axis_values
[
1
].
value
=
400
.
0
f
;
hr
=
IDWriteFactory6_CreateFontFaceReference
(
factory
,
fontfile
,
0
,
DWRITE_FONT_SIMULATIONS_NONE
,
axis_values
,
2
,
&
reference2
);
count
=
IDWriteFontFaceReference1_GetFontAxisValueCount
(
reference2
);
ok
(
count
==
2
,
"Unexpected axis value count.
\n
"
);
ret
=
IDWriteFontFaceReference1_Equals
(
reference
,
(
IDWriteFontFaceReference
*
)
reference2
);
ok
(
!
ret
,
"Unexpected result.
\n
"
);
IDWriteFontFaceReference1_Release
(
reference2
);
/* Different axis values. */
axis_values
[
0
].
axisTag
=
DWRITE_FONT_AXIS_TAG_ITALIC
;
axis_values
[
0
].
value
=
1
.
0
f
;
axis_values
[
1
].
axisTag
=
DWRITE_FONT_AXIS_TAG_WEIGHT
;
axis_values
[
1
].
value
=
401
.
0
f
;
hr
=
IDWriteFactory6_CreateFontFaceReference
(
factory
,
fontfile
,
0
,
DWRITE_FONT_SIMULATIONS_NONE
,
axis_values
,
2
,
&
reference2
);
count
=
IDWriteFontFaceReference1_GetFontAxisValueCount
(
reference2
);
ok
(
count
==
2
,
"Unexpected axis value count.
\n
"
);
ret
=
IDWriteFontFaceReference1_Equals
(
reference
,
(
IDWriteFontFaceReference
*
)
reference2
);
ok
(
!
ret
,
"Unexpected result.
\n
"
);
IDWriteFontFaceReference1_Release
(
reference2
);
IDWriteFontFaceReference1_Release
(
reference
);
IDWriteFontFile_Release
(
fontfile
);
IDWriteFontFile_Release
(
fontfile
);
IDWriteFontFace_Release
(
fontface
);
IDWriteFontFace_Release
(
fontface
);
...
...
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