Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
fecd13e1
Commit
fecd13e1
authored
Feb 03, 2020
by
Nikolay Sivov
Committed by
Alexandre Julliard
Feb 03, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dwrite: Implement GetFontFaceReference() for fontfaces.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
82df524e
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
213 additions
and
21 deletions
+213
-21
dwrite_private.h
dlls/dwrite/dwrite_private.h
+1
-0
font.c
dlls/dwrite/font.c
+199
-4
font.c
dlls/dwrite/tests/font.c
+13
-17
No files found.
dlls/dwrite/dwrite_private.h
View file @
fecd13e1
...
@@ -195,6 +195,7 @@ enum font_flags
...
@@ -195,6 +195,7 @@ enum font_flags
struct
dwrite_fontface
struct
dwrite_fontface
{
{
IDWriteFontFace5
IDWriteFontFace5_iface
;
IDWriteFontFace5
IDWriteFontFace5_iface
;
IDWriteFontFaceReference
IDWriteFontFaceReference_iface
;
LONG
refcount
;
LONG
refcount
;
IDWriteFontFileStream
*
stream
;
IDWriteFontFileStream
*
stream
;
...
...
dlls/dwrite/font.c
View file @
fecd13e1
...
@@ -290,6 +290,11 @@ static inline struct dwrite_fontface *impl_from_IDWriteFontFace5(IDWriteFontFace
...
@@ -290,6 +290,11 @@ static inline struct dwrite_fontface *impl_from_IDWriteFontFace5(IDWriteFontFace
return
CONTAINING_RECORD
(
iface
,
struct
dwrite_fontface
,
IDWriteFontFace5_iface
);
return
CONTAINING_RECORD
(
iface
,
struct
dwrite_fontface
,
IDWriteFontFace5_iface
);
}
}
static
struct
dwrite_fontface
*
impl_from_IDWriteFontFaceReference
(
IDWriteFontFaceReference
*
iface
)
{
return
CONTAINING_RECORD
(
iface
,
struct
dwrite_fontface
,
IDWriteFontFaceReference_iface
);
}
static
inline
struct
dwrite_font
*
impl_from_IDWriteFont3
(
IDWriteFont3
*
iface
)
static
inline
struct
dwrite_font
*
impl_from_IDWriteFont3
(
IDWriteFont3
*
iface
)
{
{
return
CONTAINING_RECORD
(
iface
,
struct
dwrite_font
,
IDWriteFont3_iface
);
return
CONTAINING_RECORD
(
iface
,
struct
dwrite_font
,
IDWriteFont3_iface
);
...
@@ -507,6 +512,14 @@ static HRESULT WINAPI dwritefontface_QueryInterface(IDWriteFontFace5 *iface, REF
...
@@ -507,6 +512,14 @@ static HRESULT WINAPI dwritefontface_QueryInterface(IDWriteFontFace5 *iface, REF
IsEqualIID
(
riid
,
&
IID_IUnknown
))
IsEqualIID
(
riid
,
&
IID_IUnknown
))
{
{
*
obj
=
iface
;
*
obj
=
iface
;
}
else
if
(
IsEqualIID
(
riid
,
&
IID_IDWriteFontFaceReference
))
*
obj
=
&
fontface
->
IDWriteFontFaceReference_iface
;
else
*
obj
=
NULL
;
if
(
*
obj
)
{
if
(
InterlockedIncrement
(
&
fontface
->
refcount
)
==
1
)
if
(
InterlockedIncrement
(
&
fontface
->
refcount
)
==
1
)
{
{
InterlockedDecrement
(
&
fontface
->
refcount
);
InterlockedDecrement
(
&
fontface
->
refcount
);
...
@@ -518,7 +531,6 @@ static HRESULT WINAPI dwritefontface_QueryInterface(IDWriteFontFace5 *iface, REF
...
@@ -518,7 +531,6 @@ static HRESULT WINAPI dwritefontface_QueryInterface(IDWriteFontFace5 *iface, REF
WARN
(
"%s not implemented.
\n
"
,
debugstr_guid
(
riid
));
WARN
(
"%s not implemented.
\n
"
,
debugstr_guid
(
riid
));
*
obj
=
NULL
;
return
E_NOINTERFACE
;
return
E_NOINTERFACE
;
}
}
...
@@ -1249,11 +1261,17 @@ static HRESULT WINAPI dwritefontface2_GetRecommendedRenderingMode(IDWriteFontFac
...
@@ -1249,11 +1261,17 @@ static HRESULT WINAPI dwritefontface2_GetRecommendedRenderingMode(IDWriteFontFac
return
S_OK
;
return
S_OK
;
}
}
static
HRESULT
WINAPI
dwritefontface3_GetFontFaceReference
(
IDWriteFontFace5
*
iface
,
IDWriteFontFaceReference
**
ref
)
static
HRESULT
WINAPI
dwritefontface3_GetFontFaceReference
(
IDWriteFontFace5
*
iface
,
IDWriteFontFaceReference
**
reference
)
{
{
FIXME
(
"%p, %p: stub
\n
"
,
iface
,
ref
);
struct
dwrite_fontface
*
fontface
=
impl_from_IDWriteFontFace5
(
iface
);
return
E_NOTIMPL
;
TRACE
(
"%p, %p.
\n
"
,
iface
,
reference
);
*
reference
=
&
fontface
->
IDWriteFontFaceReference_iface
;
IDWriteFontFaceReference_AddRef
(
*
reference
);
return
S_OK
;
}
}
static
void
WINAPI
dwritefontface3_GetPanose
(
IDWriteFontFace5
*
iface
,
DWRITE_PANOSE
*
panose
)
static
void
WINAPI
dwritefontface3_GetPanose
(
IDWriteFontFace5
*
iface
,
DWRITE_PANOSE
*
panose
)
...
@@ -1587,6 +1605,182 @@ static const IDWriteFontFace5Vtbl dwritefontfacevtbl =
...
@@ -1587,6 +1605,182 @@ static const IDWriteFontFace5Vtbl dwritefontfacevtbl =
dwritefontface5_GetFontResource
,
dwritefontface5_GetFontResource
,
};
};
static
HRESULT
WINAPI
dwritefontface_reference_QueryInterface
(
IDWriteFontFaceReference
*
iface
,
REFIID
riid
,
void
**
obj
)
{
struct
dwrite_fontface
*
fontface
=
impl_from_IDWriteFontFaceReference
(
iface
);
return
IDWriteFontFace5_QueryInterface
(
&
fontface
->
IDWriteFontFace5_iface
,
riid
,
obj
);
}
static
ULONG
WINAPI
dwritefontface_reference_AddRef
(
IDWriteFontFaceReference
*
iface
)
{
struct
dwrite_fontface
*
fontface
=
impl_from_IDWriteFontFaceReference
(
iface
);
return
IDWriteFontFace5_AddRef
(
&
fontface
->
IDWriteFontFace5_iface
);
}
static
ULONG
WINAPI
dwritefontface_reference_Release
(
IDWriteFontFaceReference
*
iface
)
{
struct
dwrite_fontface
*
fontface
=
impl_from_IDWriteFontFaceReference
(
iface
);
return
IDWriteFontFace5_Release
(
&
fontface
->
IDWriteFontFace5_iface
);
}
static
HRESULT
WINAPI
dwritefontface_reference_CreateFontFace
(
IDWriteFontFaceReference
*
iface
,
IDWriteFontFace3
**
ret
)
{
struct
dwrite_fontface
*
fontface
=
impl_from_IDWriteFontFaceReference
(
iface
);
TRACE
(
"%p, %p.
\n
"
,
iface
,
ret
);
*
ret
=
(
IDWriteFontFace3
*
)
&
fontface
->
IDWriteFontFace5_iface
;
IDWriteFontFace3_AddRef
(
*
ret
);
return
S_OK
;
}
static
HRESULT
WINAPI
dwritefontface_reference_CreateFontFaceWithSimulations
(
IDWriteFontFaceReference
*
iface
,
DWRITE_FONT_SIMULATIONS
simulations
,
IDWriteFontFace3
**
ret
)
{
struct
dwrite_fontface
*
fontface
=
impl_from_IDWriteFontFaceReference
(
iface
);
DWRITE_FONT_FILE_TYPE
file_type
;
DWRITE_FONT_FACE_TYPE
face_type
;
IDWriteFontFace
*
face
;
BOOL
is_supported
;
UINT32
face_num
;
HRESULT
hr
;
TRACE
(
"%p, %#x, %p.
\n
"
,
iface
,
simulations
,
ret
);
hr
=
IDWriteFontFile_Analyze
(
fontface
->
files
[
0
],
&
is_supported
,
&
file_type
,
&
face_type
,
&
face_num
);
if
(
FAILED
(
hr
))
return
hr
;
hr
=
IDWriteFactory7_CreateFontFace
(
fontface
->
factory
,
face_type
,
1
,
fontface
->
files
,
fontface
->
index
,
simulations
,
&
face
);
if
(
SUCCEEDED
(
hr
))
{
hr
=
IDWriteFontFace_QueryInterface
(
face
,
&
IID_IDWriteFontFace3
,
(
void
**
)
ret
);
IDWriteFontFace_Release
(
face
);
}
return
hr
;
}
static
BOOL
WINAPI
dwritefontface_reference_Equals
(
IDWriteFontFaceReference
*
iface
,
IDWriteFontFaceReference
*
ref
)
{
FIXME
(
"%p, %p.
\n
"
,
iface
,
ref
);
return
E_NOTIMPL
;
}
static
UINT32
WINAPI
dwritefontface_reference_GetFontFaceIndex
(
IDWriteFontFaceReference
*
iface
)
{
struct
dwrite_fontface
*
fontface
=
impl_from_IDWriteFontFaceReference
(
iface
);
TRACE
(
"%p.
\n
"
,
iface
);
return
fontface
->
index
;
}
static
DWRITE_FONT_SIMULATIONS
WINAPI
dwritefontface_reference_GetSimulations
(
IDWriteFontFaceReference
*
iface
)
{
struct
dwrite_fontface
*
fontface
=
impl_from_IDWriteFontFaceReference
(
iface
);
TRACE
(
"%p.
\n
"
,
iface
);
return
fontface
->
simulations
;
}
static
HRESULT
WINAPI
dwritefontface_reference_GetFontFile
(
IDWriteFontFaceReference
*
iface
,
IDWriteFontFile
**
file
)
{
struct
dwrite_fontface
*
fontface
=
impl_from_IDWriteFontFaceReference
(
iface
);
TRACE
(
"%p, %p.
\n
"
,
iface
,
file
);
*
file
=
fontface
->
files
[
0
];
IDWriteFontFile_AddRef
(
*
file
);
return
S_OK
;
}
static
UINT64
WINAPI
dwritefontface_reference_GetLocalFileSize
(
IDWriteFontFaceReference
*
iface
)
{
FIXME
(
"%p.
\n
"
,
iface
);
return
0
;
}
static
UINT64
WINAPI
dwritefontface_reference_GetFileSize
(
IDWriteFontFaceReference
*
iface
)
{
FIXME
(
"%p.
\n
"
,
iface
);
return
0
;
}
static
HRESULT
WINAPI
dwritefontface_reference_GetFileTime
(
IDWriteFontFaceReference
*
iface
,
FILETIME
*
writetime
)
{
FIXME
(
"%p, %p.
\n
"
,
iface
,
writetime
);
return
E_NOTIMPL
;
}
static
DWRITE_LOCALITY
WINAPI
dwritefontface_reference_GetLocality
(
IDWriteFontFaceReference
*
iface
)
{
FIXME
(
"%p.
\n
"
,
iface
);
return
DWRITE_LOCALITY_LOCAL
;
}
static
HRESULT
WINAPI
dwritefontface_reference_EnqueueFontDownloadRequest
(
IDWriteFontFaceReference
*
iface
)
{
FIXME
(
"%p.
\n
"
,
iface
);
return
E_NOTIMPL
;
}
static
HRESULT
WINAPI
dwritefontface_reference_EnqueueCharacterDownloadRequest
(
IDWriteFontFaceReference
*
iface
,
WCHAR
const
*
chars
,
UINT32
count
)
{
FIXME
(
"%p, %s, %u.
\n
"
,
iface
,
debugstr_wn
(
chars
,
count
),
count
);
return
E_NOTIMPL
;
}
static
HRESULT
WINAPI
dwritefontface_reference_EnqueueGlyphDownloadRequest
(
IDWriteFontFaceReference
*
iface
,
UINT16
const
*
glyphs
,
UINT32
count
)
{
FIXME
(
"%p, %p, %u.
\n
"
,
iface
,
glyphs
,
count
);
return
E_NOTIMPL
;
}
static
HRESULT
WINAPI
dwritefontface_reference_EnqueueFileFragmentDownloadRequest
(
IDWriteFontFaceReference
*
iface
,
UINT64
offset
,
UINT64
size
)
{
FIXME
(
"%p, 0x%s, 0x%s.
\n
"
,
iface
,
wine_dbgstr_longlong
(
offset
),
wine_dbgstr_longlong
(
size
));
return
E_NOTIMPL
;
}
static
const
IDWriteFontFaceReferenceVtbl
dwritefontface_reference_vtbl
=
{
dwritefontface_reference_QueryInterface
,
dwritefontface_reference_AddRef
,
dwritefontface_reference_Release
,
dwritefontface_reference_CreateFontFace
,
dwritefontface_reference_CreateFontFaceWithSimulations
,
dwritefontface_reference_Equals
,
dwritefontface_reference_GetFontFaceIndex
,
dwritefontface_reference_GetSimulations
,
dwritefontface_reference_GetFontFile
,
dwritefontface_reference_GetLocalFileSize
,
dwritefontface_reference_GetFileSize
,
dwritefontface_reference_GetFileTime
,
dwritefontface_reference_GetLocality
,
dwritefontface_reference_EnqueueFontDownloadRequest
,
dwritefontface_reference_EnqueueCharacterDownloadRequest
,
dwritefontface_reference_EnqueueGlyphDownloadRequest
,
dwritefontface_reference_EnqueueFileFragmentDownloadRequest
,
};
static
HRESULT
get_fontface_from_font
(
struct
dwrite_font
*
font
,
IDWriteFontFace5
**
fontface
)
static
HRESULT
get_fontface_from_font
(
struct
dwrite_font
*
font
,
IDWriteFontFace5
**
fontface
)
{
{
struct
dwrite_font_data
*
data
=
font
->
data
;
struct
dwrite_font_data
*
data
=
font
->
data
;
...
@@ -4677,6 +4871,7 @@ HRESULT create_fontface(const struct fontface_desc *desc, struct list *cached_li
...
@@ -4677,6 +4871,7 @@ HRESULT create_fontface(const struct fontface_desc *desc, struct list *cached_li
}
}
fontface
->
IDWriteFontFace5_iface
.
lpVtbl
=
&
dwritefontfacevtbl
;
fontface
->
IDWriteFontFace5_iface
.
lpVtbl
=
&
dwritefontfacevtbl
;
fontface
->
IDWriteFontFaceReference_iface
.
lpVtbl
=
&
dwritefontface_reference_vtbl
;
fontface
->
refcount
=
1
;
fontface
->
refcount
=
1
;
fontface
->
type
=
desc
->
face_type
;
fontface
->
type
=
desc
->
face_type
;
fontface
->
file_count
=
desc
->
files_number
;
fontface
->
file_count
=
desc
->
files_number
;
...
...
dlls/dwrite/tests/font.c
View file @
fecd13e1
...
@@ -7775,9 +7775,8 @@ static void test_HasCharacter(void)
...
@@ -7775,9 +7775,8 @@ static void test_HasCharacter(void)
static
void
test_CreateFontFaceReference
(
void
)
static
void
test_CreateFontFaceReference
(
void
)
{
{
static
const
WCHAR
dummyW
[]
=
{
'd'
,
'u'
,
'm'
,
'm'
,
'y'
,
0
}
;
IDWriteFontFaceReference
*
ref
,
*
ref1
,
*
ref3
;
IDWriteFontFace3
*
fontface
,
*
fontface1
;
IDWriteFontFace3
*
fontface
,
*
fontface1
;
IDWriteFontFaceReference
*
ref
,
*
ref1
;
IDWriteFontCollection1
*
collection
;
IDWriteFontCollection1
*
collection
;
IDWriteFontFile
*
file
,
*
file1
;
IDWriteFontFile
*
file
,
*
file1
;
IDWriteFactory3
*
factory
;
IDWriteFactory3
*
factory
;
...
@@ -7821,7 +7820,7 @@ todo_wine
...
@@ -7821,7 +7820,7 @@ todo_wine
IDWriteFontFaceReference_Release
(
ref
);
IDWriteFontFaceReference_Release
(
ref
);
/* path however has to be valid */
/* path however has to be valid */
hr
=
IDWriteFactory3_CreateFontFaceReference
(
factory
,
dummyW
,
NULL
,
0
,
DWRITE_FONT_SIMULATIONS_NONE
,
&
ref
);
hr
=
IDWriteFactory3_CreateFontFaceReference
(
factory
,
L"dummy"
,
NULL
,
0
,
DWRITE_FONT_SIMULATIONS_NONE
,
&
ref
);
todo_wine
todo_wine
ok
(
hr
==
DWRITE_E_FILENOTFOUND
,
"got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
DWRITE_E_FILENOTFOUND
,
"got 0x%08x
\n
"
,
hr
);
if
(
hr
==
S_OK
)
if
(
hr
==
S_OK
)
...
@@ -7939,34 +7938,31 @@ todo_wine
...
@@ -7939,34 +7938,31 @@ todo_wine
IDWriteFontFaceReference_Release
(
ref1
);
IDWriteFontFaceReference_Release
(
ref1
);
hr
=
IDWriteFontFace3_GetFontFaceReference
(
fontface
,
&
ref
);
hr
=
IDWriteFontFace3_GetFontFaceReference
(
fontface
,
&
ref
);
todo_wine
ok
(
hr
==
S_OK
,
"Failed to get a reference, hr %#x.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Failed to get a reference, hr %#x.
\n
"
,
hr
);
EXPECT_REF
(
fontface
,
2
);
hr
=
IDWriteFontFace3_GetFontFaceReference
(
fontface
,
&
ref1
);
hr
=
IDWriteFontFace3_GetFontFaceReference
(
fontface
,
&
ref1
);
todo_wine
ok
(
hr
==
S_OK
,
"Failed to get a reference, hr %#x.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Failed to get a reference, hr %#x.
\n
"
,
hr
);
if
(
hr
==
S_OK
)
ok
(
ref
==
ref1
,
"Unexpected reference %p, %p.
\n
"
,
ref1
,
ref
);
ok
(
ref
==
ref1
,
"Unexpected reference %p, %p.
\n
"
,
ref1
,
ref
);
EXPECT_REF
(
fontface
,
3
);
hr
=
IDWriteFontFace3_QueryInterface
(
fontface
,
&
IID_IDWriteFontFaceReference
,
(
void
**
)
&
ref3
);
ok
(
hr
==
S_OK
||
broken
(
FAILED
(
hr
)),
"Failed to get interface, hr %#x.
\n
"
,
hr
);
if
(
SUCCEEDED
(
hr
))
{
ok
(
ref
==
ref3
,
"Unexpected reference %p.
\n
"
,
ref3
);
IDWriteFontFaceReference_Release
(
ref3
);
}
if
(
hr
==
S_OK
)
{
hr
=
IDWriteFontFaceReference_CreateFontFace
(
ref
,
&
fontface1
);
hr
=
IDWriteFontFaceReference_CreateFontFace
(
ref
,
&
fontface1
);
ok
(
hr
==
S_OK
,
"Failed to create fontface, hr %#x.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Failed to create fontface, hr %#x.
\n
"
,
hr
);
ok
(
fontface1
==
fontface
,
"Unexpected fontface %p, %p.
\n
"
,
fontface1
,
fontface
);
ok
(
fontface1
==
fontface
,
"Unexpected fontface %p, %p.
\n
"
,
fontface1
,
fontface
);
IDWriteFontFace3_Release
(
fontface1
);
IDWriteFontFace3_Release
(
fontface1
);
if
(
SUCCEEDED
(
hr
=
IDWriteFontFaceReference_QueryInterface
(
ref
,
&
IID_IDWriteFontFaceReference1
,
(
void
**
)
&
ref2
)))
{
UINT32
axis_count
=
IDWriteFontFaceReference1_GetFontAxisValueCount
(
ref2
);
ok
(
!
axis_count
,
"Unexpected axis value count.
\n
"
);
IDWriteFontFaceReference1_Release
(
ref2
);
}
IDWriteFontFaceReference_Release
(
ref
);
IDWriteFontFaceReference_Release
(
ref
);
IDWriteFontFaceReference_Release
(
ref1
);
IDWriteFontFaceReference_Release
(
ref1
);
}
IDWriteFontFace3_Release
(
fontface
);
IDWriteFontFace3_Release
(
fontface
);
IDWriteFont3_Release
(
font3
);
IDWriteFont3_Release
(
font3
);
}
}
...
...
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