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
7e665fd2
Commit
7e665fd2
authored
Dec 05, 2019
by
Nikolay Sivov
Committed by
Alexandre Julliard
Dec 05, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dwrite: Add newer CreateFontFaceReference() variant.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
6f7a9158
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
55 additions
and
20 deletions
+55
-20
dwrite_private.h
dlls/dwrite/dwrite_private.h
+3
-2
font.c
dlls/dwrite/font.c
+21
-5
main.c
dlls/dwrite/main.c
+12
-7
font.c
dlls/dwrite/tests/font.c
+19
-6
No files found.
dlls/dwrite/dwrite_private.h
View file @
7e665fd2
...
...
@@ -262,8 +262,9 @@ extern void release_system_fontfallback(IDWriteFontFallback1 *fallback) DECLSPEC
extern
HRESULT
create_fontfallback_builder
(
IDWriteFactory5
*
,
IDWriteFontFallbackBuilder
**
)
DECLSPEC_HIDDEN
;
extern
HRESULT
create_matching_font
(
IDWriteFontCollection
*
,
const
WCHAR
*
,
DWRITE_FONT_WEIGHT
,
DWRITE_FONT_STYLE
,
DWRITE_FONT_STRETCH
,
IDWriteFont
**
)
DECLSPEC_HIDDEN
;
extern
HRESULT
create_fontfacereference
(
IDWriteFactory5
*
,
IDWriteFontFile
*
,
UINT32
,
DWRITE_FONT_SIMULATIONS
,
IDWriteFontFaceReference
**
)
DECLSPEC_HIDDEN
;
extern
HRESULT
create_fontfacereference
(
IDWriteFactory5
*
factory
,
IDWriteFontFile
*
file
,
UINT32
face_index
,
DWRITE_FONT_SIMULATIONS
simulations
,
DWRITE_FONT_AXIS_VALUE
const
*
axis_values
,
UINT32
axis_values_count
,
IDWriteFontFaceReference1
**
reference
)
DECLSPEC_HIDDEN
;
extern
HRESULT
factory_get_cached_fontface
(
IDWriteFactory5
*
,
IDWriteFontFile
*
const
*
,
UINT32
,
DWRITE_FONT_SIMULATIONS
,
struct
list
**
,
REFIID
,
void
**
)
DECLSPEC_HIDDEN
;
extern
void
factory_detach_fontcollection
(
IDWriteFactory5
*
factory
,
IDWriteFontCollection3
*
collection
)
DECLSPEC_HIDDEN
;
...
...
dlls/dwrite/font.c
View file @
7e665fd2
...
...
@@ -231,6 +231,8 @@ struct dwrite_fontfacereference
IDWriteFontFile
*
file
;
UINT32
index
;
USHORT
simulations
;
DWRITE_FONT_AXIS_VALUE
*
axis_values
;
UINT32
axis_values_count
;
IDWriteFactory5
*
factory
;
};
...
...
@@ -6081,6 +6083,7 @@ static ULONG WINAPI fontfacereference_Release(IDWriteFontFaceReference1 *iface)
{
IDWriteFontFile_Release
(
reference
->
file
);
IDWriteFactory5_Release
(
reference
->
factory
);
heap_free
(
reference
->
axis_values
);
heap_free
(
reference
);
}
...
...
@@ -6253,9 +6256,11 @@ static HRESULT WINAPI fontfacereference1_CreateFontFace(IDWriteFontFaceReference
static
UINT32
WINAPI
fontfacereference1_GetFontAxisValueCount
(
IDWriteFontFaceReference1
*
iface
)
{
FIXME
(
"%p.
\n
"
,
iface
);
struct
dwrite_fontfacereference
*
reference
=
impl_from_IDWriteFontFaceReference1
(
iface
);
return
0
;
TRACE
(
"%p.
\n
"
,
iface
);
return
reference
->
axis_values_count
;
}
static
HRESULT
WINAPI
fontfacereference1_GetFontAxisValues
(
IDWriteFontFaceReference1
*
iface
,
...
...
@@ -6291,7 +6296,8 @@ static const IDWriteFontFaceReference1Vtbl fontfacereferencevtbl =
};
HRESULT
create_fontfacereference
(
IDWriteFactory5
*
factory
,
IDWriteFontFile
*
file
,
UINT32
index
,
DWRITE_FONT_SIMULATIONS
simulations
,
IDWriteFontFaceReference
**
ret
)
DWRITE_FONT_SIMULATIONS
simulations
,
DWRITE_FONT_AXIS_VALUE
const
*
axis_values
,
UINT32
axis_values_count
,
IDWriteFontFaceReference1
**
ret
)
{
struct
dwrite_fontfacereference
*
object
;
...
...
@@ -6300,7 +6306,7 @@ HRESULT create_fontfacereference(IDWriteFactory5 *factory, IDWriteFontFile *file
if
(
!
is_simulation_valid
(
simulations
))
return
E_INVALIDARG
;
object
=
heap_alloc
(
sizeof
(
*
object
));
object
=
heap_alloc
_zero
(
sizeof
(
*
object
));
if
(
!
object
)
return
E_OUTOFMEMORY
;
...
...
@@ -6313,8 +6319,18 @@ HRESULT create_fontfacereference(IDWriteFactory5 *factory, IDWriteFontFile *file
IDWriteFontFile_AddRef
(
object
->
file
);
object
->
index
=
index
;
object
->
simulations
=
simulations
;
if
(
axis_values_count
)
{
if
(
!
(
object
->
axis_values
=
heap_alloc
(
axis_values_count
*
sizeof
(
*
axis_values
))))
{
IDWriteFontFaceReference1_Release
(
&
object
->
IDWriteFontFaceReference1_iface
);
return
E_OUTOFMEMORY
;
}
memcpy
(
object
->
axis_values
,
axis_values
,
axis_values_count
*
sizeof
(
*
axis_values
));
object
->
axis_values_count
=
axis_values_count
;
}
*
ret
=
(
IDWriteFontFaceReference
*
)
&
object
->
IDWriteFontFaceReference1_iface
;
*
ret
=
&
object
->
IDWriteFontFaceReference1_iface
;
return
S_OK
;
}
...
...
dlls/dwrite/main.c
View file @
7e665fd2
...
...
@@ -1443,7 +1443,8 @@ static HRESULT WINAPI dwritefactory3_CreateFontFaceReference_(IDWriteFactory7 *i
{
TRACE
(
"%p, %p, %u, %x, %p.
\n
"
,
iface
,
file
,
index
,
simulations
,
reference
);
return
create_fontfacereference
((
IDWriteFactory5
*
)
iface
,
file
,
index
,
simulations
,
reference
);
return
create_fontfacereference
((
IDWriteFactory5
*
)
iface
,
file
,
index
,
simulations
,
NULL
,
0
,
(
IDWriteFontFaceReference1
**
)
reference
);
}
static
HRESULT
WINAPI
dwritefactory3_CreateFontFaceReference
(
IDWriteFactory7
*
iface
,
WCHAR
const
*
path
,
...
...
@@ -1455,13 +1456,15 @@ static HRESULT WINAPI dwritefactory3_CreateFontFaceReference(IDWriteFactory7 *if
TRACE
(
"%p, %s, %p, %u, %#x, %p.
\n
"
,
iface
,
debugstr_w
(
path
),
writetime
,
index
,
simulations
,
reference
);
hr
=
IDWriteFactory5_CreateFontFileReference
((
IDWriteFactory5
*
)
iface
,
path
,
writetime
,
&
file
);
if
(
FAILED
(
hr
))
{
hr
=
IDWriteFactory7_CreateFontFileReference
(
iface
,
path
,
writetime
,
&
file
);
if
(
FAILED
(
hr
))
{
*
reference
=
NULL
;
return
hr
;
}
hr
=
IDWriteFactory5_CreateFontFaceReference_
((
IDWriteFactory5
*
)
iface
,
file
,
index
,
simulations
,
reference
);
hr
=
create_fontfacereference
((
IDWriteFactory5
*
)
iface
,
file
,
index
,
simulations
,
NULL
,
0
,
(
IDWriteFontFaceReference1
**
)
reference
);
IDWriteFontFile_Release
(
file
);
return
hr
;
}
...
...
@@ -1656,11 +1659,13 @@ static HRESULT WINAPI dwritefactory5_UnpackFontFile(IDWriteFactory7 *iface, DWRI
static
HRESULT
WINAPI
dwritefactory6_CreateFontFaceReference
(
IDWriteFactory7
*
iface
,
IDWriteFontFile
*
file
,
UINT32
face_index
,
DWRITE_FONT_SIMULATIONS
simulations
,
DWRITE_FONT_AXIS_VALUE
const
*
axis_values
,
UINT32
num_axis
,
IDWriteFontFaceReference1
**
ref
)
UINT32
axis_values_count
,
IDWriteFontFaceReference1
**
reference
)
{
FIXME
(
"%p, %p, %u, %#x, %p, %u, %p.
\n
"
,
iface
,
file
,
face_index
,
simulations
,
axis_values
,
num_axis
,
ref
);
TRACE
(
"%p, %p, %u, %#x, %p, %u, %p.
\n
"
,
iface
,
file
,
face_index
,
simulations
,
axis_values
,
axis_values_count
,
reference
);
return
E_NOTIMPL
;
return
create_fontfacereference
((
IDWriteFactory5
*
)
iface
,
file
,
face_index
,
simulations
,
axis_values
,
axis_values_count
,
reference
);
}
static
HRESULT
WINAPI
dwritefactory6_CreateFontResource
(
IDWriteFactory7
*
iface
,
IDWriteFontFile
*
file
,
...
...
dlls/dwrite/tests/font.c
View file @
7e665fd2
...
...
@@ -9239,6 +9239,7 @@ static void test_font_resource(void)
IDWriteFontFaceReference1
*
reference
,
*
reference2
;
IDWriteFontResource
*
resource
,
*
resource2
;
IDWriteFontFile
*
fontfile
,
*
fontfile2
;
DWRITE_FONT_AXIS_VALUE
axis_value
;
IDWriteFontFace5
*
fontface5
;
IDWriteFontFace
*
fontface
;
IDWriteFactory6
*
factory
;
...
...
@@ -9274,22 +9275,34 @@ static void test_font_resource(void)
index
=
IDWriteFontResource_GetFontFaceIndex
(
resource
);
ok
(
!
index
,
"Unexpected index %u.
\n
"
,
index
);
/* Specify axis value, font has no variations. */
axis_value
.
axisTag
=
DWRITE_FONT_AXIS_TAG_WEIGHT
;
axis_value
.
value
=
400
.
0
f
;
hr
=
IDWriteFontResource_CreateFontFaceReference
(
resource
,
DWRITE_FONT_SIMULATIONS_NONE
,
&
axis_value
,
1
,
&
reference
);
ok
(
hr
==
S_OK
,
"Failed to create reference object, hr %#x.
\n
"
,
hr
);
count
=
IDWriteFontFaceReference1_GetFontAxisValueCount
(
reference
);
ok
(
count
==
1
,
"Unexpected axis value count.
\n
"
);
IDWriteFontFaceReference1_Release
(
reference
);
hr
=
IDWriteFactory6_CreateFontFaceReference
(
factory
,
fontfile
,
0
,
DWRITE_FONT_SIMULATIONS_NONE
,
&
axis_value
,
1
,
&
reference
);
count
=
IDWriteFontFaceReference1_GetFontAxisValueCount
(
reference
);
ok
(
count
==
1
,
"Unexpected axis value count.
\n
"
);
IDWriteFontFaceReference1_Release
(
reference
);
EXPECT_REF
(
resource
,
1
);
hr
=
IDWriteFontResource_CreateFontFaceReference
(
resource
,
DWRITE_FONT_SIMULATIONS_NONE
,
NULL
,
0
,
&
reference
);
todo_wine
ok
(
hr
==
S_OK
,
"Failed to create reference object, hr %#x.
\n
"
,
hr
);
EXPECT_REF
(
resource
,
1
);
hr
=
IDWriteFontResource_CreateFontFaceReference
(
resource
,
DWRITE_FONT_SIMULATIONS_NONE
,
NULL
,
0
,
&
reference2
);
todo_wine
ok
(
hr
==
S_OK
,
"Failed to create reference object, hr %#x.
\n
"
,
hr
);
if
(
SUCCEEDED
(
hr
))
{
ok
(
reference
!=
reference2
,
"Unexpected reference instance.
\n
"
);
IDWriteFontFaceReference1_Release
(
reference2
);
IDWriteFontFaceReference1_Release
(
reference
);
}
hr
=
IDWriteFontFace_QueryInterface
(
fontface
,
&
IID_IDWriteFontFace5
,
(
void
**
)
&
fontface5
);
ok
(
hr
==
S_OK
,
"Failed to get interface, hr %#x.
\n
"
,
hr
);
...
...
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