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
393d50f9
Commit
393d50f9
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 partial implementation for IDWriteFontResource.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
18f561a7
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
233 additions
and
12 deletions
+233
-12
dwrite_private.h
dlls/dwrite/dwrite_private.h
+2
-0
font.c
dlls/dwrite/font.c
+217
-0
main.c
dlls/dwrite/main.c
+2
-2
font.c
dlls/dwrite/tests/font.c
+12
-10
No files found.
dlls/dwrite/dwrite_private.h
View file @
393d50f9
...
@@ -279,6 +279,8 @@ extern void fontface_detach_from_cache(IDWriteFontFace5 *fontface) DECLSPEC_HIDD
...
@@ -279,6 +279,8 @@ extern void fontface_detach_from_cache(IDWriteFontFace5 *fontface) DECLSPEC_HIDD
extern
void
factory_lock
(
IDWriteFactory5
*
)
DECLSPEC_HIDDEN
;
extern
void
factory_lock
(
IDWriteFactory5
*
)
DECLSPEC_HIDDEN
;
extern
void
factory_unlock
(
IDWriteFactory5
*
)
DECLSPEC_HIDDEN
;
extern
void
factory_unlock
(
IDWriteFactory5
*
)
DECLSPEC_HIDDEN
;
extern
HRESULT
create_inmemory_fileloader
(
IDWriteFontFileLoader
**
)
DECLSPEC_HIDDEN
;
extern
HRESULT
create_inmemory_fileloader
(
IDWriteFontFileLoader
**
)
DECLSPEC_HIDDEN
;
extern
HRESULT
create_font_resource
(
IDWriteFactory7
*
factory
,
IDWriteFontFile
*
file
,
UINT32
face_index
,
IDWriteFontResource
**
resource
)
DECLSPEC_HIDDEN
;
struct
dwrite_fontface
;
struct
dwrite_fontface
;
...
...
dlls/dwrite/font.c
View file @
393d50f9
...
@@ -234,6 +234,16 @@ struct dwrite_fontfacereference
...
@@ -234,6 +234,16 @@ struct dwrite_fontfacereference
IDWriteFactory5
*
factory
;
IDWriteFactory5
*
factory
;
};
};
struct
dwrite_fontresource
{
IDWriteFontResource
IDWriteFontResource_iface
;
LONG
refcount
;
IDWriteFontFile
*
file
;
UINT32
face_index
;
IDWriteFactory7
*
factory
;
};
static
void
dwrite_grab_font_table
(
void
*
context
,
UINT32
table
,
const
BYTE
**
data
,
UINT32
*
size
,
void
**
data_context
)
static
void
dwrite_grab_font_table
(
void
*
context
,
UINT32
table
,
const
BYTE
**
data
,
UINT32
*
size
,
void
**
data_context
)
{
{
struct
dwrite_fontface
*
fontface
=
context
;
struct
dwrite_fontface
*
fontface
=
context
;
...
@@ -325,6 +335,11 @@ static inline struct dwrite_fontfacereference *impl_from_IDWriteFontFaceReferenc
...
@@ -325,6 +335,11 @@ static inline struct dwrite_fontfacereference *impl_from_IDWriteFontFaceReferenc
return
CONTAINING_RECORD
(
iface
,
struct
dwrite_fontfacereference
,
IDWriteFontFaceReference1_iface
);
return
CONTAINING_RECORD
(
iface
,
struct
dwrite_fontfacereference
,
IDWriteFontFaceReference1_iface
);
}
}
static
struct
dwrite_fontresource
*
impl_from_IDWriteFontResource
(
IDWriteFontResource
*
iface
)
{
return
CONTAINING_RECORD
(
iface
,
struct
dwrite_fontresource
,
IDWriteFontResource_iface
);
}
static
HRESULT
get_cached_glyph_metrics
(
struct
dwrite_fontface
*
fontface
,
UINT16
glyph
,
DWRITE_GLYPH_METRICS
*
metrics
)
static
HRESULT
get_cached_glyph_metrics
(
struct
dwrite_fontface
*
fontface
,
UINT16
glyph
,
DWRITE_GLYPH_METRICS
*
metrics
)
{
{
static
const
DWRITE_GLYPH_METRICS
nil
;
static
const
DWRITE_GLYPH_METRICS
nil
;
...
@@ -6555,3 +6570,205 @@ HRESULT create_inmemory_fileloader(IDWriteFontFileLoader **ret)
...
@@ -6555,3 +6570,205 @@ HRESULT create_inmemory_fileloader(IDWriteFontFileLoader **ret)
return
S_OK
;
return
S_OK
;
}
}
static
HRESULT
WINAPI
dwritefontresource_QueryInterface
(
IDWriteFontResource
*
iface
,
REFIID
riid
,
void
**
obj
)
{
TRACE
(
"%p, %s, %p.
\n
"
,
iface
,
debugstr_guid
(
riid
),
obj
);
if
(
IsEqualIID
(
riid
,
&
IID_IDWriteFontResource
)
||
IsEqualIID
(
riid
,
&
IID_IUnknown
))
{
*
obj
=
iface
;
IDWriteFontResource_AddRef
(
iface
);
return
S_OK
;
}
WARN
(
"Unsupported interface %s.
\n
"
,
debugstr_guid
(
riid
));
return
E_NOINTERFACE
;
}
static
ULONG
WINAPI
dwritefontresource_AddRef
(
IDWriteFontResource
*
iface
)
{
struct
dwrite_fontresource
*
resource
=
impl_from_IDWriteFontResource
(
iface
);
ULONG
refcount
=
InterlockedIncrement
(
&
resource
->
refcount
);
TRACE
(
"%p, refcount %u.
\n
"
,
iface
,
refcount
);
return
refcount
;
}
static
ULONG
WINAPI
dwritefontresource_Release
(
IDWriteFontResource
*
iface
)
{
struct
dwrite_fontresource
*
resource
=
impl_from_IDWriteFontResource
(
iface
);
ULONG
refcount
=
InterlockedDecrement
(
&
resource
->
refcount
);
TRACE
(
"%p, refcount %u.
\n
"
,
iface
,
refcount
);
if
(
!
refcount
)
{
IDWriteFactory7_Release
(
resource
->
factory
);
IDWriteFontFile_Release
(
resource
->
file
);
heap_free
(
resource
);
}
return
refcount
;
}
static
HRESULT
WINAPI
dwritefontresource_GetFontFile
(
IDWriteFontResource
*
iface
,
IDWriteFontFile
**
fontfile
)
{
struct
dwrite_fontresource
*
resource
=
impl_from_IDWriteFontResource
(
iface
);
TRACE
(
"%p, %p.
\n
"
,
iface
,
fontfile
);
*
fontfile
=
resource
->
file
;
IDWriteFontFile_AddRef
(
*
fontfile
);
return
S_OK
;
}
static
UINT32
WINAPI
dwritefontresource_GetFontFaceIndex
(
IDWriteFontResource
*
iface
)
{
struct
dwrite_fontresource
*
resource
=
impl_from_IDWriteFontResource
(
iface
);
TRACE
(
"%p.
\n
"
,
iface
);
return
resource
->
face_index
;
}
static
UINT32
WINAPI
dwritefontresource_GetFontAxisCount
(
IDWriteFontResource
*
iface
)
{
FIXME
(
"%p.
\n
"
,
iface
);
return
0
;
}
static
HRESULT
WINAPI
dwritefontresource_GetDefaultFontAxisValues
(
IDWriteFontResource
*
iface
,
DWRITE_FONT_AXIS_VALUE
const
*
values
,
UINT32
num_values
)
{
FIXME
(
"%p, %p, %u.
\n
"
,
iface
,
values
,
num_values
);
return
E_NOTIMPL
;
}
static
HRESULT
WINAPI
dwritefontresource_GetFontAxisRanges
(
IDWriteFontResource
*
iface
,
DWRITE_FONT_AXIS_RANGE
const
*
ranges
,
UINT32
num_ranges
)
{
FIXME
(
"%p, %p, %u.
\n
"
,
iface
,
ranges
,
num_ranges
);
return
E_NOTIMPL
;
}
static
DWRITE_FONT_AXIS_ATTRIBUTES
WINAPI
dwritefontresource_GetFontAxisAttributes
(
IDWriteFontResource
*
iface
,
UINT32
axis
)
{
FIXME
(
"%p, %u.
\n
"
,
iface
,
axis
);
return
DWRITE_FONT_AXIS_ATTRIBUTES_NONE
;
}
static
HRESULT
WINAPI
dwritefontresource_GetAxisNames
(
IDWriteFontResource
*
iface
,
UINT32
axis
,
IDWriteLocalizedStrings
**
names
)
{
FIXME
(
"%p, %u, %p.
\n
"
,
iface
,
axis
,
names
);
return
E_NOTIMPL
;
}
static
UINT32
WINAPI
dwritefontresource_GetAxisValueNameCount
(
IDWriteFontResource
*
iface
,
UINT32
axis
)
{
FIXME
(
"%p, %u.
\n
"
,
iface
,
axis
);
return
0
;
}
static
HRESULT
WINAPI
dwritefontresource_GetAxisValueNames
(
IDWriteFontResource
*
iface
,
UINT32
axis
,
UINT32
axis_value
,
DWRITE_FONT_AXIS_RANGE
*
axis_range
,
IDWriteLocalizedStrings
**
names
)
{
FIXME
(
"%p, %u, %u, %p, %p.
\n
"
,
iface
,
axis
,
axis_value
,
axis_range
,
names
);
return
E_NOTIMPL
;
}
static
BOOL
WINAPI
dwritefontresource_HasVariations
(
IDWriteFontResource
*
iface
)
{
FIXME
(
"%p.
\n
"
,
iface
);
return
FALSE
;
}
static
HRESULT
WINAPI
dwritefontresource_CreateFontFace
(
IDWriteFontResource
*
iface
,
DWRITE_FONT_SIMULATIONS
simulations
,
DWRITE_FONT_AXIS_VALUE
const
*
axis_values
,
UINT32
num_values
,
IDWriteFontFace5
**
fontface
)
{
struct
dwrite_fontresource
*
resource
=
impl_from_IDWriteFontResource
(
iface
);
IDWriteFontFaceReference1
*
reference
;
HRESULT
hr
;
TRACE
(
"%p, %#x, %p, %u, %p.
\n
"
,
iface
,
simulations
,
axis_values
,
num_values
,
fontface
);
hr
=
IDWriteFactory7_CreateFontFaceReference
(
resource
->
factory
,
resource
->
file
,
resource
->
face_index
,
simulations
,
axis_values
,
num_values
,
&
reference
);
if
(
SUCCEEDED
(
hr
))
{
hr
=
IDWriteFontFaceReference1_CreateFontFace
(
reference
,
fontface
);
IDWriteFontFaceReference1_Release
(
reference
);
}
return
hr
;
}
static
HRESULT
WINAPI
dwritefontresource_CreateFontFaceReference
(
IDWriteFontResource
*
iface
,
DWRITE_FONT_SIMULATIONS
simulations
,
DWRITE_FONT_AXIS_VALUE
const
*
axis_values
,
UINT32
num_values
,
IDWriteFontFaceReference1
**
reference
)
{
struct
dwrite_fontresource
*
resource
=
impl_from_IDWriteFontResource
(
iface
);
TRACE
(
"%p, %#x, %p, %u, %p.
\n
"
,
iface
,
simulations
,
axis_values
,
num_values
,
reference
);
return
IDWriteFactory7_CreateFontFaceReference
(
resource
->
factory
,
resource
->
file
,
resource
->
face_index
,
simulations
,
axis_values
,
num_values
,
reference
);
}
static
const
IDWriteFontResourceVtbl
fontresourcevtbl
=
{
dwritefontresource_QueryInterface
,
dwritefontresource_AddRef
,
dwritefontresource_Release
,
dwritefontresource_GetFontFile
,
dwritefontresource_GetFontFaceIndex
,
dwritefontresource_GetFontAxisCount
,
dwritefontresource_GetDefaultFontAxisValues
,
dwritefontresource_GetFontAxisRanges
,
dwritefontresource_GetFontAxisAttributes
,
dwritefontresource_GetAxisNames
,
dwritefontresource_GetAxisValueNameCount
,
dwritefontresource_GetAxisValueNames
,
dwritefontresource_HasVariations
,
dwritefontresource_CreateFontFace
,
dwritefontresource_CreateFontFaceReference
,
};
HRESULT
create_font_resource
(
IDWriteFactory7
*
factory
,
IDWriteFontFile
*
file
,
UINT32
face_index
,
IDWriteFontResource
**
ret
)
{
struct
dwrite_fontresource
*
resource
;
*
ret
=
NULL
;
resource
=
heap_alloc_zero
(
sizeof
(
*
resource
));
if
(
!
resource
)
return
E_OUTOFMEMORY
;
resource
->
IDWriteFontResource_iface
.
lpVtbl
=
&
fontresourcevtbl
;
resource
->
refcount
=
1
;
resource
->
face_index
=
face_index
;
resource
->
file
=
file
;
IDWriteFontFile_AddRef
(
resource
->
file
);
resource
->
factory
=
factory
;
IDWriteFactory7_AddRef
(
resource
->
factory
);
*
ret
=
&
resource
->
IDWriteFontResource_iface
;
return
S_OK
;
}
dlls/dwrite/main.c
View file @
393d50f9
...
@@ -1666,9 +1666,9 @@ static HRESULT WINAPI dwritefactory6_CreateFontFaceReference(IDWriteFactory7 *if
...
@@ -1666,9 +1666,9 @@ static HRESULT WINAPI dwritefactory6_CreateFontFaceReference(IDWriteFactory7 *if
static
HRESULT
WINAPI
dwritefactory6_CreateFontResource
(
IDWriteFactory7
*
iface
,
IDWriteFontFile
*
file
,
static
HRESULT
WINAPI
dwritefactory6_CreateFontResource
(
IDWriteFactory7
*
iface
,
IDWriteFontFile
*
file
,
UINT32
face_index
,
IDWriteFontResource
**
resource
)
UINT32
face_index
,
IDWriteFontResource
**
resource
)
{
{
FIXM
E
(
"%p, %p, %u, %p.
\n
"
,
iface
,
file
,
face_index
,
resource
);
TRAC
E
(
"%p, %p, %u, %p.
\n
"
,
iface
,
file
,
face_index
,
resource
);
return
E_NOTIMPL
;
return
create_font_resource
(
iface
,
file
,
face_index
,
resource
)
;
}
}
static
HRESULT
WINAPI
dwritefactory6_GetSystemFontSet
(
IDWriteFactory7
*
iface
,
BOOL
include_downloadable
,
static
HRESULT
WINAPI
dwritefactory6_GetSystemFontSet
(
IDWriteFactory7
*
iface
,
BOOL
include_downloadable
,
...
...
dlls/dwrite/tests/font.c
View file @
393d50f9
...
@@ -9259,17 +9259,8 @@ static void test_font_resource(void)
...
@@ -9259,17 +9259,8 @@ static void test_font_resource(void)
ok
(
hr
==
S_OK
,
"Failed to get file object, hr %#x.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Failed to get file object, hr %#x.
\n
"
,
hr
);
hr
=
IDWriteFactory6_CreateFontResource
(
factory
,
fontfile
,
0
,
&
resource
);
hr
=
IDWriteFactory6_CreateFontResource
(
factory
,
fontfile
,
0
,
&
resource
);
todo_wine
ok
(
hr
==
S_OK
,
"Failed to create font resource, hr %#x.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Failed to create font resource, hr %#x.
\n
"
,
hr
);
if
(
FAILED
(
hr
))
{
IDWriteFactory6_Release
(
factory
);
IDWriteFontFile_Release
(
fontfile
);
IDWriteFontFace_Release
(
fontface
);
return
;
}
hr
=
IDWriteFactory6_CreateFontResource
(
factory
,
fontfile
,
0
,
&
resource2
);
hr
=
IDWriteFactory6_CreateFontResource
(
factory
,
fontfile
,
0
,
&
resource2
);
ok
(
hr
==
S_OK
,
"Failed to create font resource, hr %#x.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Failed to create font resource, hr %#x.
\n
"
,
hr
);
ok
(
resource
!=
resource2
,
"Unexpected instance.
\n
"
);
ok
(
resource
!=
resource2
,
"Unexpected instance.
\n
"
);
...
@@ -9283,18 +9274,29 @@ todo_wine
...
@@ -9283,18 +9274,29 @@ todo_wine
index
=
IDWriteFontResource_GetFontFaceIndex
(
resource
);
index
=
IDWriteFontResource_GetFontFaceIndex
(
resource
);
ok
(
!
index
,
"Unexpected index %u.
\n
"
,
index
);
ok
(
!
index
,
"Unexpected index %u.
\n
"
,
index
);
EXPECT_REF
(
resource
,
1
);
hr
=
IDWriteFontResource_CreateFontFaceReference
(
resource
,
DWRITE_FONT_SIMULATIONS_NONE
,
NULL
,
0
,
&
reference
);
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
);
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
);
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
);
ok
(
hr
==
S_OK
,
"Failed to create reference object, hr %#x.
\n
"
,
hr
);
if
(
SUCCEEDED
(
hr
))
{
ok
(
reference
!=
reference2
,
"Unexpected reference instance.
\n
"
);
ok
(
reference
!=
reference2
,
"Unexpected reference instance.
\n
"
);
IDWriteFontFaceReference1_Release
(
reference2
);
IDWriteFontFaceReference1_Release
(
reference2
);
IDWriteFontFaceReference1_Release
(
reference
);
IDWriteFontFaceReference1_Release
(
reference
);
}
hr
=
IDWriteFontFace_QueryInterface
(
fontface
,
&
IID_IDWriteFontFace5
,
(
void
**
)
&
fontface5
);
hr
=
IDWriteFontFace_QueryInterface
(
fontface
,
&
IID_IDWriteFontFace5
,
(
void
**
)
&
fontface5
);
todo_wine
ok
(
hr
==
S_OK
,
"Failed to get interface, hr %#x.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Failed to get interface, hr %#x.
\n
"
,
hr
);
if
(
FAILED
(
hr
))
return
;
hr
=
IDWriteFontFace5_GetFontResource
(
fontface5
,
&
resource2
);
hr
=
IDWriteFontFace5_GetFontResource
(
fontface5
,
&
resource2
);
ok
(
hr
==
S_OK
,
"Failed to get font resource, hr %#x.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Failed to get font resource, hr %#x.
\n
"
,
hr
);
ok
(
resource
!=
resource2
,
"Unexpected resource instance.
\n
"
);
ok
(
resource
!=
resource2
,
"Unexpected resource instance.
\n
"
);
...
...
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