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
05e42a55
Commit
05e42a55
authored
Mar 08, 2016
by
Nikolay Sivov
Committed by
Alexandre Julliard
Mar 09, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dwrite: Update to IDWriteFontFamily1.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
1da5af93
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
109 additions
and
43 deletions
+109
-43
font.c
dlls/dwrite/font.c
+74
-41
font.c
dlls/dwrite/tests/font.c
+35
-2
No files found.
dlls/dwrite/font.c
View file @
05e42a55
...
...
@@ -100,7 +100,7 @@ struct dwrite_fontlist {
IDWriteFontList
IDWriteFontList_iface
;
LONG
ref
;
IDWriteFontFamily
*
family
;
IDWriteFontFamily
1
*
family
;
struct
dwrite_font_data
**
fonts
;
UINT32
font_count
;
};
...
...
@@ -129,7 +129,7 @@ struct dwrite_fontcollection {
};
struct
dwrite_fontfamily
{
IDWriteFontFamily
IDWriteFontFamily
_iface
;
IDWriteFontFamily
1
IDWriteFontFamily1
_iface
;
LONG
ref
;
struct
dwrite_fontfamily_data
*
data
;
...
...
@@ -141,7 +141,7 @@ struct dwrite_font {
IDWriteFont3
IDWriteFont3_iface
;
LONG
ref
;
IDWriteFontFamily
*
family
;
IDWriteFontFamily
1
*
family
;
DWRITE_FONT_STYLE
style
;
struct
dwrite_font_data
*
data
;
...
...
@@ -258,9 +258,9 @@ static inline struct dwrite_fontfile *impl_from_IDWriteFontFile(IDWriteFontFile
return
CONTAINING_RECORD
(
iface
,
struct
dwrite_fontfile
,
IDWriteFontFile_iface
);
}
static
inline
struct
dwrite_fontfamily
*
impl_from_IDWriteFontFamily
(
IDWriteFontFamily
*
iface
)
static
inline
struct
dwrite_fontfamily
*
impl_from_IDWriteFontFamily
1
(
IDWriteFontFamily1
*
iface
)
{
return
CONTAINING_RECORD
(
iface
,
struct
dwrite_fontfamily
,
IDWriteFontFamily_iface
);
return
CONTAINING_RECORD
(
iface
,
struct
dwrite_fontfamily
,
IDWriteFontFamily
1
_iface
);
}
static
inline
struct
dwrite_fontcollection
*
impl_from_IDWriteFontCollection
(
IDWriteFontCollection
*
iface
)
...
...
@@ -1259,7 +1259,7 @@ static ULONG WINAPI dwritefont_Release(IDWriteFont3 *iface)
TRACE
(
"(%p)->(%d)
\n
"
,
This
,
ref
);
if
(
!
ref
)
{
IDWriteFontFamily_Release
(
This
->
family
);
IDWriteFontFamily
1
_Release
(
This
->
family
);
release_font_data
(
This
->
data
);
heap_free
(
This
);
}
...
...
@@ -1272,7 +1272,7 @@ static HRESULT WINAPI dwritefont_GetFontFamily(IDWriteFont3 *iface, IDWriteFontF
struct
dwrite_font
*
This
=
impl_from_IDWriteFont3
(
iface
);
TRACE
(
"(%p)->(%p)
\n
"
,
This
,
family
);
*
family
=
This
->
family
;
*
family
=
(
IDWriteFontFamily
*
)
This
->
family
;
IDWriteFontFamily_AddRef
(
*
family
);
return
S_OK
;
}
...
...
@@ -1541,7 +1541,7 @@ static const IDWriteFont3Vtbl dwritefontvtbl = {
dwritefont3_GetLocality
};
static
HRESULT
create_font
(
struct
dwrite_font_data
*
data
,
IDWriteFontFamily
*
family
,
IDWriteFont
**
font
)
static
HRESULT
create_font
(
struct
dwrite_font_data
*
data
,
IDWriteFontFamily
1
*
family
,
IDWriteFont
**
font
)
{
struct
dwrite_font
*
This
;
*
font
=
NULL
;
...
...
@@ -1552,7 +1552,7 @@ static HRESULT create_font(struct dwrite_font_data *data, IDWriteFontFamily *fam
This
->
IDWriteFont3_iface
.
lpVtbl
=
&
dwritefontvtbl
;
This
->
ref
=
1
;
This
->
family
=
family
;
IDWriteFontFamily_AddRef
(
family
);
IDWriteFontFamily
1
_AddRef
(
family
);
This
->
style
=
data
->
style
;
This
->
data
=
data
;
InterlockedIncrement
(
&
This
->
data
->
ref
);
...
...
@@ -1601,7 +1601,7 @@ static ULONG WINAPI dwritefontlist_Release(IDWriteFontList *iface)
for
(
i
=
0
;
i
<
This
->
font_count
;
i
++
)
release_font_data
(
This
->
fonts
[
i
]);
IDWriteFontFamily_Release
(
This
->
family
);
IDWriteFontFamily
1
_Release
(
This
->
family
);
heap_free
(
This
);
}
...
...
@@ -1611,7 +1611,7 @@ static ULONG WINAPI dwritefontlist_Release(IDWriteFontList *iface)
static
HRESULT
WINAPI
dwritefontlist_GetFontCollection
(
IDWriteFontList
*
iface
,
IDWriteFontCollection
**
collection
)
{
struct
dwrite_fontlist
*
This
=
impl_from_IDWriteFontList
(
iface
);
return
IDWriteFontFamily_GetFontCollection
(
This
->
family
,
collection
);
return
IDWriteFontFamily
1
_GetFontCollection
(
This
->
family
,
collection
);
}
static
UINT32
WINAPI
dwritefontlist_GetFontCount
(
IDWriteFontList
*
iface
)
...
...
@@ -1647,17 +1647,19 @@ static const IDWriteFontListVtbl dwritefontlistvtbl = {
dwritefontlist_GetFont
};
static
HRESULT
WINAPI
dwritefontfamily_QueryInterface
(
IDWriteFontFamily
*
iface
,
REFIID
riid
,
void
**
obj
)
static
HRESULT
WINAPI
dwritefontfamily_QueryInterface
(
IDWriteFontFamily
1
*
iface
,
REFIID
riid
,
void
**
obj
)
{
struct
dwrite_fontfamily
*
This
=
impl_from_IDWriteFontFamily
(
iface
);
struct
dwrite_fontfamily
*
This
=
impl_from_IDWriteFontFamily1
(
iface
);
TRACE
(
"(%p)->(%s %p)
\n
"
,
This
,
debugstr_guid
(
riid
),
obj
);
if
(
IsEqualIID
(
riid
,
&
IID_IUnknown
)
||
if
(
IsEqualIID
(
riid
,
&
IID_IDWriteFontFamily1
)
||
IsEqualIID
(
riid
,
&
IID_IDWriteFontFamily
)
||
IsEqualIID
(
riid
,
&
IID_IDWriteFontList
)
||
IsEqualIID
(
riid
,
&
IID_I
DWriteFontFamily
))
IsEqualIID
(
riid
,
&
IID_I
Unknown
))
{
*
obj
=
iface
;
IDWriteFontFamily_AddRef
(
iface
);
IDWriteFontFamily
1
_AddRef
(
iface
);
return
S_OK
;
}
...
...
@@ -1665,17 +1667,17 @@ static HRESULT WINAPI dwritefontfamily_QueryInterface(IDWriteFontFamily *iface,
return
E_NOINTERFACE
;
}
static
ULONG
WINAPI
dwritefontfamily_AddRef
(
IDWriteFontFamily
*
iface
)
static
ULONG
WINAPI
dwritefontfamily_AddRef
(
IDWriteFontFamily
1
*
iface
)
{
struct
dwrite_fontfamily
*
This
=
impl_from_IDWriteFontFamily
(
iface
);
struct
dwrite_fontfamily
*
This
=
impl_from_IDWriteFontFamily
1
(
iface
);
ULONG
ref
=
InterlockedIncrement
(
&
This
->
ref
);
TRACE
(
"(%p)->(%d)
\n
"
,
This
,
ref
);
return
ref
;
}
static
ULONG
WINAPI
dwritefontfamily_Release
(
IDWriteFontFamily
*
iface
)
static
ULONG
WINAPI
dwritefontfamily_Release
(
IDWriteFontFamily
1
*
iface
)
{
struct
dwrite_fontfamily
*
This
=
impl_from_IDWriteFontFamily
(
iface
);
struct
dwrite_fontfamily
*
This
=
impl_from_IDWriteFontFamily
1
(
iface
);
ULONG
ref
=
InterlockedDecrement
(
&
This
->
ref
);
TRACE
(
"(%p)->(%d)
\n
"
,
This
,
ref
);
...
...
@@ -1690,9 +1692,9 @@ static ULONG WINAPI dwritefontfamily_Release(IDWriteFontFamily *iface)
return
ref
;
}
static
HRESULT
WINAPI
dwritefontfamily_GetFontCollection
(
IDWriteFontFamily
*
iface
,
IDWriteFontCollection
**
collection
)
static
HRESULT
WINAPI
dwritefontfamily_GetFontCollection
(
IDWriteFontFamily
1
*
iface
,
IDWriteFontCollection
**
collection
)
{
struct
dwrite_fontfamily
*
This
=
impl_from_IDWriteFontFamily
(
iface
);
struct
dwrite_fontfamily
*
This
=
impl_from_IDWriteFontFamily
1
(
iface
);
TRACE
(
"(%p)->(%p)
\n
"
,
This
,
collection
);
*
collection
=
This
->
collection
;
...
...
@@ -1700,16 +1702,16 @@ static HRESULT WINAPI dwritefontfamily_GetFontCollection(IDWriteFontFamily *ifac
return
S_OK
;
}
static
UINT32
WINAPI
dwritefontfamily_GetFontCount
(
IDWriteFontFamily
*
iface
)
static
UINT32
WINAPI
dwritefontfamily_GetFontCount
(
IDWriteFontFamily
1
*
iface
)
{
struct
dwrite_fontfamily
*
This
=
impl_from_IDWriteFontFamily
(
iface
);
struct
dwrite_fontfamily
*
This
=
impl_from_IDWriteFontFamily
1
(
iface
);
TRACE
(
"(%p)
\n
"
,
This
);
return
This
->
data
->
font_count
;
}
static
HRESULT
WINAPI
dwritefontfamily_GetFont
(
IDWriteFontFamily
*
iface
,
UINT32
index
,
IDWriteFont
**
font
)
static
HRESULT
WINAPI
dwritefontfamily_GetFont
(
IDWriteFontFamily
1
*
iface
,
UINT32
index
,
IDWriteFont
**
font
)
{
struct
dwrite_fontfamily
*
This
=
impl_from_IDWriteFontFamily
(
iface
);
struct
dwrite_fontfamily
*
This
=
impl_from_IDWriteFontFamily
1
(
iface
);
TRACE
(
"(%p)->(%u %p)
\n
"
,
This
,
index
,
font
);
...
...
@@ -1724,9 +1726,9 @@ static HRESULT WINAPI dwritefontfamily_GetFont(IDWriteFontFamily *iface, UINT32
return
create_font
(
This
->
data
->
fonts
[
index
],
iface
,
font
);
}
static
HRESULT
WINAPI
dwritefontfamily_GetFamilyNames
(
IDWriteFontFamily
*
iface
,
IDWriteLocalizedStrings
**
names
)
static
HRESULT
WINAPI
dwritefontfamily_GetFamilyNames
(
IDWriteFontFamily
1
*
iface
,
IDWriteLocalizedStrings
**
names
)
{
struct
dwrite_fontfamily
*
This
=
impl_from_IDWriteFontFamily
(
iface
);
struct
dwrite_fontfamily
*
This
=
impl_from_IDWriteFontFamily
1
(
iface
);
return
clone_localizedstring
(
This
->
data
->
familyname
,
names
);
}
...
...
@@ -1771,10 +1773,10 @@ static BOOL is_better_font_match(const struct dwrite_font_propvec *next, const s
return
FALSE
;
}
static
HRESULT
WINAPI
dwritefontfamily_GetFirstMatchingFont
(
IDWriteFontFamily
*
iface
,
DWRITE_FONT_WEIGHT
weight
,
static
HRESULT
WINAPI
dwritefontfamily_GetFirstMatchingFont
(
IDWriteFontFamily
1
*
iface
,
DWRITE_FONT_WEIGHT
weight
,
DWRITE_FONT_STRETCH
stretch
,
DWRITE_FONT_STYLE
style
,
IDWriteFont
**
font
)
{
struct
dwrite_fontfamily
*
This
=
impl_from_IDWriteFontFamily
(
iface
);
struct
dwrite_fontfamily
*
This
=
impl_from_IDWriteFontFamily
1
(
iface
);
struct
dwrite_font_propvec
req
;
struct
dwrite_font_data
*
match
;
UINT32
i
;
...
...
@@ -1831,10 +1833,10 @@ static void matchingfonts_sort(struct dwrite_fontlist *fonts, const struct dwrit
};
}
static
HRESULT
WINAPI
dwritefontfamily_GetMatchingFonts
(
IDWriteFontFamily
*
iface
,
DWRITE_FONT_WEIGHT
weight
,
static
HRESULT
WINAPI
dwritefontfamily_GetMatchingFonts
(
IDWriteFontFamily
1
*
iface
,
DWRITE_FONT_WEIGHT
weight
,
DWRITE_FONT_STRETCH
stretch
,
DWRITE_FONT_STYLE
style
,
IDWriteFontList
**
ret
)
{
struct
dwrite_fontfamily
*
This
=
impl_from_IDWriteFontFamily
(
iface
);
struct
dwrite_fontfamily
*
This
=
impl_from_IDWriteFontFamily
1
(
iface
);
matching_filter_func
func
=
NULL
;
struct
dwrite_font_propvec
req
;
struct
dwrite_fontlist
*
fonts
;
...
...
@@ -1858,7 +1860,7 @@ static HRESULT WINAPI dwritefontfamily_GetMatchingFonts(IDWriteFontFamily *iface
fonts
->
IDWriteFontList_iface
.
lpVtbl
=
&
dwritefontlistvtbl
;
fonts
->
ref
=
1
;
fonts
->
family
=
iface
;
IDWriteFontFamily_AddRef
(
fonts
->
family
);
IDWriteFontFamily
1
_AddRef
(
fonts
->
family
);
fonts
->
font_count
=
0
;
/* Normal style accepts Normal or Italic, Oblique and Italic - both Oblique and Italic styles */
...
...
@@ -1887,7 +1889,35 @@ static HRESULT WINAPI dwritefontfamily_GetMatchingFonts(IDWriteFontFamily *iface
return
S_OK
;
}
static
const
IDWriteFontFamilyVtbl
fontfamilyvtbl
=
{
static
DWRITE_LOCALITY
WINAPI
dwritefontfamily1_GetFontLocality
(
IDWriteFontFamily1
*
iface
,
UINT32
index
)
{
struct
dwrite_fontfamily
*
This
=
impl_from_IDWriteFontFamily1
(
iface
);
FIXME
(
"(%p)->(%u): stub
\n
"
,
This
,
index
);
return
DWRITE_LOCALITY_LOCAL
;
}
static
HRESULT
WINAPI
dwritefontfamily1_GetFont
(
IDWriteFontFamily1
*
iface
,
UINT32
index
,
IDWriteFont3
**
font
)
{
struct
dwrite_fontfamily
*
This
=
impl_from_IDWriteFontFamily1
(
iface
);
FIXME
(
"(%p)->(%u %p): stub
\n
"
,
This
,
index
,
font
);
return
E_NOTIMPL
;
}
static
HRESULT
WINAPI
dwritefontfamily1_GetFontFaceReference
(
IDWriteFontFamily1
*
iface
,
UINT32
index
,
IDWriteFontFaceReference
**
ref
)
{
struct
dwrite_fontfamily
*
This
=
impl_from_IDWriteFontFamily1
(
iface
);
FIXME
(
"(%p)->(%u %p): stub
\n
"
,
This
,
index
,
ref
);
return
E_NOTIMPL
;
}
static
const
IDWriteFontFamily1Vtbl
fontfamilyvtbl
=
{
dwritefontfamily_QueryInterface
,
dwritefontfamily_AddRef
,
dwritefontfamily_Release
,
...
...
@@ -1896,10 +1926,13 @@ static const IDWriteFontFamilyVtbl fontfamilyvtbl = {
dwritefontfamily_GetFont
,
dwritefontfamily_GetFamilyNames
,
dwritefontfamily_GetFirstMatchingFont
,
dwritefontfamily_GetMatchingFonts
dwritefontfamily_GetMatchingFonts
,
dwritefontfamily1_GetFontLocality
,
dwritefontfamily1_GetFont
,
dwritefontfamily1_GetFontFaceReference
};
static
HRESULT
create_fontfamily
(
struct
dwrite_fontfamily_data
*
data
,
IDWriteFontCollection
*
collection
,
IDWriteFontFamily
**
family
)
static
HRESULT
create_fontfamily
(
struct
dwrite_fontfamily_data
*
data
,
IDWriteFontCollection
*
collection
,
IDWriteFontFamily
1
**
family
)
{
struct
dwrite_fontfamily
*
This
;
...
...
@@ -1908,14 +1941,14 @@ static HRESULT create_fontfamily(struct dwrite_fontfamily_data *data, IDWriteFon
This
=
heap_alloc
(
sizeof
(
struct
dwrite_fontfamily
));
if
(
!
This
)
return
E_OUTOFMEMORY
;
This
->
IDWriteFontFamily_iface
.
lpVtbl
=
&
fontfamilyvtbl
;
This
->
IDWriteFontFamily
1
_iface
.
lpVtbl
=
&
fontfamilyvtbl
;
This
->
ref
=
1
;
This
->
collection
=
collection
;
IDWriteFontCollection_AddRef
(
collection
);
This
->
data
=
data
;
InterlockedIncrement
(
&
This
->
data
->
ref
);
*
family
=
&
This
->
IDWriteFontFamily_iface
;
*
family
=
&
This
->
IDWriteFontFamily
1
_iface
;
return
S_OK
;
}
...
...
@@ -1990,7 +2023,7 @@ static HRESULT WINAPI dwritefontcollection_GetFontFamily(IDWriteFontCollection *
return
E_FAIL
;
}
return
create_fontfamily
(
This
->
family_data
[
index
],
iface
,
family
);
return
create_fontfamily
(
This
->
family_data
[
index
],
iface
,
(
IDWriteFontFamily1
**
)
family
);
}
static
UINT32
collection_find_family
(
struct
dwrite_fontcollection
*
collection
,
const
WCHAR
*
name
)
...
...
@@ -2050,7 +2083,7 @@ static HRESULT WINAPI dwritefontcollection_GetFontFromFontFace(IDWriteFontCollec
struct
dwrite_fontcollection
*
This
=
impl_from_IDWriteFontCollection
(
iface
);
struct
dwrite_fontfamily_data
*
found_family
=
NULL
;
struct
dwrite_font_data
*
found_font
=
NULL
;
IDWriteFontFamily
*
family
;
IDWriteFontFamily
1
*
family
;
UINT32
i
,
j
,
face_index
;
IDWriteFontFile
*
file
;
HRESULT
hr
;
...
...
@@ -2089,7 +2122,7 @@ static HRESULT WINAPI dwritefontcollection_GetFontFromFontFace(IDWriteFontCollec
return
hr
;
hr
=
create_font
(
found_font
,
family
,
font
);
IDWriteFontFamily_Release
(
family
);
IDWriteFontFamily
1
_Release
(
family
);
return
hr
;
}
...
...
dlls/dwrite/tests/font.c
View file @
05e42a55
...
...
@@ -1055,6 +1055,7 @@ static void test_GetFontFamily(void)
IDWriteFontCollection
*
collection
,
*
collection2
;
IDWriteFontCollection
*
syscoll
;
IDWriteFontFamily
*
family
,
*
family2
;
IDWriteFontFamily1
*
family1
;
IDWriteGdiInterop
*
interop
;
IDWriteFont
*
font
,
*
font2
;
IDWriteFactory
*
factory
;
...
...
@@ -1117,13 +1118,45 @@ if (0) /* crashes on native */
ok
(
collection
==
collection2
,
"got %p, %p
\n
"
,
collection
,
collection2
);
ok
(
collection
==
syscoll
,
"got %p, %p
\n
"
,
collection
,
syscoll
);
IDWriteFont_Release
(
font
);
IDWriteFont_Release
(
font2
);
hr
=
IDWriteFontFamily_QueryInterface
(
family
,
&
IID_IDWriteFontFamily1
,
(
void
**
)
&
family1
);
if
(
hr
==
S_OK
)
{
IDWriteFont3
*
font3
;
IDWriteFont1
*
font1
;
font3
=
(
void
*
)
0xdeadbeef
;
hr
=
IDWriteFontFamily1_GetFont
(
family1
,
~
0u
,
&
font3
);
todo_wine
{
ok
(
hr
==
E_FAIL
,
"got 0x%08x
\n
"
,
hr
);
ok
(
font3
==
NULL
,
"got %p
\n
"
,
font3
);
}
hr
=
IDWriteFontFamily1_GetFont
(
family1
,
0
,
&
font3
);
todo_wine
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
if
(
hr
==
S_OK
)
{
hr
=
IDWriteFont3_QueryInterface
(
font3
,
&
IID_IDWriteFont
,
(
void
**
)
&
font
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
IDWriteFont_Release
(
font
);
hr
=
IDWriteFont3_QueryInterface
(
font3
,
&
IID_IDWriteFont1
,
(
void
**
)
&
font1
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
IDWriteFont1_Release
(
font1
);
IDWriteFont3_Release
(
font3
);
}
IDWriteFontFamily1_Release
(
family1
);
}
else
win_skip
(
"IDWriteFontFamily1 is not supported.
\n
"
);
IDWriteFontCollection_Release
(
syscoll
);
IDWriteFontCollection_Release
(
collection2
);
IDWriteFontCollection_Release
(
collection
);
IDWriteFontFamily_Release
(
family2
);
IDWriteFontFamily_Release
(
family
);
IDWriteFont_Release
(
font
);
IDWriteFont_Release
(
font2
);
IDWriteGdiInterop_Release
(
interop
);
IDWriteFactory_Release
(
factory
);
}
...
...
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