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
fa6c255f
Commit
fa6c255f
authored
Mar 07, 2016
by
Nikolay Sivov
Committed by
Alexandre Julliard
Mar 07, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dwrite: Update to IDWriteFont3.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
27ca16c7
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
130 additions
and
49 deletions
+130
-49
font.c
dlls/dwrite/font.c
+86
-46
font.c
dlls/dwrite/tests/font.c
+35
-3
dwrite_3.idl
include/dwrite_3.idl
+9
-0
No files found.
dlls/dwrite/font.c
View file @
fa6c255f
...
...
@@ -138,7 +138,7 @@ struct dwrite_fontfamily {
};
struct
dwrite_font
{
IDWriteFont
2
IDWriteFont2
_iface
;
IDWriteFont
3
IDWriteFont3
_iface
;
LONG
ref
;
IDWriteFontFamily
*
family
;
...
...
@@ -248,9 +248,9 @@ static inline struct dwrite_fontface *impl_from_IDWriteFontFace3(IDWriteFontFace
return
CONTAINING_RECORD
(
iface
,
struct
dwrite_fontface
,
IDWriteFontFace3_iface
);
}
static
inline
struct
dwrite_font
*
impl_from_IDWriteFont
2
(
IDWriteFont2
*
iface
)
static
inline
struct
dwrite_font
*
impl_from_IDWriteFont
3
(
IDWriteFont3
*
iface
)
{
return
CONTAINING_RECORD
(
iface
,
struct
dwrite_font
,
IDWriteFont
2
_iface
);
return
CONTAINING_RECORD
(
iface
,
struct
dwrite_font
,
IDWriteFont
3
_iface
);
}
static
inline
struct
dwrite_fontfile
*
impl_from_IDWriteFontFile
(
IDWriteFontFile
*
iface
)
...
...
@@ -1223,9 +1223,9 @@ static HRESULT get_fontface_from_font(struct dwrite_font *font, IDWriteFontFace3
return
hr
;
}
static
HRESULT
WINAPI
dwritefont_QueryInterface
(
IDWriteFont
2
*
iface
,
REFIID
riid
,
void
**
obj
)
static
HRESULT
WINAPI
dwritefont_QueryInterface
(
IDWriteFont
3
*
iface
,
REFIID
riid
,
void
**
obj
)
{
struct
dwrite_font
*
This
=
impl_from_IDWriteFont
2
(
iface
);
struct
dwrite_font
*
This
=
impl_from_IDWriteFont
3
(
iface
);
TRACE
(
"(%p)->(%s %p)
\n
"
,
This
,
debugstr_guid
(
riid
),
obj
);
...
...
@@ -1235,7 +1235,7 @@ static HRESULT WINAPI dwritefont_QueryInterface(IDWriteFont2 *iface, REFIID riid
IsEqualIID
(
riid
,
&
IID_IUnknown
))
{
*
obj
=
iface
;
IDWriteFont
2
_AddRef
(
iface
);
IDWriteFont
3
_AddRef
(
iface
);
return
S_OK
;
}
...
...
@@ -1243,17 +1243,17 @@ static HRESULT WINAPI dwritefont_QueryInterface(IDWriteFont2 *iface, REFIID riid
return
E_NOINTERFACE
;
}
static
ULONG
WINAPI
dwritefont_AddRef
(
IDWriteFont
2
*
iface
)
static
ULONG
WINAPI
dwritefont_AddRef
(
IDWriteFont
3
*
iface
)
{
struct
dwrite_font
*
This
=
impl_from_IDWriteFont
2
(
iface
);
struct
dwrite_font
*
This
=
impl_from_IDWriteFont
3
(
iface
);
ULONG
ref
=
InterlockedIncrement
(
&
This
->
ref
);
TRACE
(
"(%p)->(%d)
\n
"
,
This
,
ref
);
return
ref
;
}
static
ULONG
WINAPI
dwritefont_Release
(
IDWriteFont
2
*
iface
)
static
ULONG
WINAPI
dwritefont_Release
(
IDWriteFont
3
*
iface
)
{
struct
dwrite_font
*
This
=
impl_from_IDWriteFont
2
(
iface
);
struct
dwrite_font
*
This
=
impl_from_IDWriteFont
3
(
iface
);
ULONG
ref
=
InterlockedDecrement
(
&
This
->
ref
);
TRACE
(
"(%p)->(%d)
\n
"
,
This
,
ref
);
...
...
@@ -1267,9 +1267,9 @@ static ULONG WINAPI dwritefont_Release(IDWriteFont2 *iface)
return
ref
;
}
static
HRESULT
WINAPI
dwritefont_GetFontFamily
(
IDWriteFont
2
*
iface
,
IDWriteFontFamily
**
family
)
static
HRESULT
WINAPI
dwritefont_GetFontFamily
(
IDWriteFont
3
*
iface
,
IDWriteFontFamily
**
family
)
{
struct
dwrite_font
*
This
=
impl_from_IDWriteFont
2
(
iface
);
struct
dwrite_font
*
This
=
impl_from_IDWriteFont
3
(
iface
);
TRACE
(
"(%p)->(%p)
\n
"
,
This
,
family
);
*
family
=
This
->
family
;
...
...
@@ -1277,30 +1277,30 @@ static HRESULT WINAPI dwritefont_GetFontFamily(IDWriteFont2 *iface, IDWriteFontF
return
S_OK
;
}
static
DWRITE_FONT_WEIGHT
WINAPI
dwritefont_GetWeight
(
IDWriteFont
2
*
iface
)
static
DWRITE_FONT_WEIGHT
WINAPI
dwritefont_GetWeight
(
IDWriteFont
3
*
iface
)
{
struct
dwrite_font
*
This
=
impl_from_IDWriteFont
2
(
iface
);
struct
dwrite_font
*
This
=
impl_from_IDWriteFont
3
(
iface
);
TRACE
(
"(%p)
\n
"
,
This
);
return
This
->
data
->
weight
;
}
static
DWRITE_FONT_STRETCH
WINAPI
dwritefont_GetStretch
(
IDWriteFont
2
*
iface
)
static
DWRITE_FONT_STRETCH
WINAPI
dwritefont_GetStretch
(
IDWriteFont
3
*
iface
)
{
struct
dwrite_font
*
This
=
impl_from_IDWriteFont
2
(
iface
);
struct
dwrite_font
*
This
=
impl_from_IDWriteFont
3
(
iface
);
TRACE
(
"(%p)
\n
"
,
This
);
return
This
->
data
->
stretch
;
}
static
DWRITE_FONT_STYLE
WINAPI
dwritefont_GetStyle
(
IDWriteFont
2
*
iface
)
static
DWRITE_FONT_STYLE
WINAPI
dwritefont_GetStyle
(
IDWriteFont
3
*
iface
)
{
struct
dwrite_font
*
This
=
impl_from_IDWriteFont
2
(
iface
);
struct
dwrite_font
*
This
=
impl_from_IDWriteFont
3
(
iface
);
TRACE
(
"(%p)
\n
"
,
This
);
return
This
->
style
;
}
static
BOOL
WINAPI
dwritefont_IsSymbolFont
(
IDWriteFont
2
*
iface
)
static
BOOL
WINAPI
dwritefont_IsSymbolFont
(
IDWriteFont
3
*
iface
)
{
struct
dwrite_font
*
This
=
impl_from_IDWriteFont
2
(
iface
);
struct
dwrite_font
*
This
=
impl_from_IDWriteFont
3
(
iface
);
IDWriteFontFace3
*
fontface
;
HRESULT
hr
;
...
...
@@ -1313,17 +1313,17 @@ static BOOL WINAPI dwritefont_IsSymbolFont(IDWriteFont2 *iface)
return
IDWriteFontFace3_IsSymbolFont
(
fontface
);
}
static
HRESULT
WINAPI
dwritefont_GetFaceNames
(
IDWriteFont
2
*
iface
,
IDWriteLocalizedStrings
**
names
)
static
HRESULT
WINAPI
dwritefont_GetFaceNames
(
IDWriteFont
3
*
iface
,
IDWriteLocalizedStrings
**
names
)
{
struct
dwrite_font
*
This
=
impl_from_IDWriteFont
2
(
iface
);
struct
dwrite_font
*
This
=
impl_from_IDWriteFont
3
(
iface
);
TRACE
(
"(%p)->(%p)
\n
"
,
This
,
names
);
return
clone_localizedstring
(
This
->
data
->
names
,
names
);
}
static
HRESULT
WINAPI
dwritefont_GetInformationalStrings
(
IDWriteFont
2
*
iface
,
static
HRESULT
WINAPI
dwritefont_GetInformationalStrings
(
IDWriteFont
3
*
iface
,
DWRITE_INFORMATIONAL_STRING_ID
stringid
,
IDWriteLocalizedStrings
**
strings
,
BOOL
*
exists
)
{
struct
dwrite_font
*
This
=
impl_from_IDWriteFont
2
(
iface
);
struct
dwrite_font
*
This
=
impl_from_IDWriteFont
3
(
iface
);
struct
dwrite_font_data
*
data
=
This
->
data
;
HRESULT
hr
;
...
...
@@ -1367,24 +1367,24 @@ static HRESULT WINAPI dwritefont_GetInformationalStrings(IDWriteFont2 *iface,
return
S_OK
;
}
static
DWRITE_FONT_SIMULATIONS
WINAPI
dwritefont_GetSimulations
(
IDWriteFont
2
*
iface
)
static
DWRITE_FONT_SIMULATIONS
WINAPI
dwritefont_GetSimulations
(
IDWriteFont
3
*
iface
)
{
struct
dwrite_font
*
This
=
impl_from_IDWriteFont
2
(
iface
);
struct
dwrite_font
*
This
=
impl_from_IDWriteFont
3
(
iface
);
TRACE
(
"(%p)
\n
"
,
This
);
return
This
->
data
->
simulations
;
}
static
void
WINAPI
dwritefont_GetMetrics
(
IDWriteFont
2
*
iface
,
DWRITE_FONT_METRICS
*
metrics
)
static
void
WINAPI
dwritefont_GetMetrics
(
IDWriteFont
3
*
iface
,
DWRITE_FONT_METRICS
*
metrics
)
{
struct
dwrite_font
*
This
=
impl_from_IDWriteFont
2
(
iface
);
struct
dwrite_font
*
This
=
impl_from_IDWriteFont
3
(
iface
);
TRACE
(
"(%p)->(%p)
\n
"
,
This
,
metrics
);
memcpy
(
metrics
,
&
This
->
data
->
metrics
,
sizeof
(
*
metrics
));
}
static
HRESULT
WINAPI
dwritefont_HasCharacter
(
IDWriteFont
2
*
iface
,
UINT32
value
,
BOOL
*
exists
)
static
HRESULT
WINAPI
dwritefont_HasCharacter
(
IDWriteFont
3
*
iface
,
UINT32
value
,
BOOL
*
exists
)
{
struct
dwrite_font
*
This
=
impl_from_IDWriteFont
2
(
iface
);
struct
dwrite_font
*
This
=
impl_from_IDWriteFont
3
(
iface
);
IDWriteFontFace3
*
fontface
;
UINT16
index
;
HRESULT
hr
;
...
...
@@ -1406,9 +1406,9 @@ static HRESULT WINAPI dwritefont_HasCharacter(IDWriteFont2 *iface, UINT32 value,
return
S_OK
;
}
static
HRESULT
WINAPI
dwritefont_CreateFontFace
(
IDWriteFont
2
*
iface
,
IDWriteFontFace
**
face
)
static
HRESULT
WINAPI
dwritefont_CreateFontFace
(
IDWriteFont
3
*
iface
,
IDWriteFontFace
**
face
)
{
struct
dwrite_font
*
This
=
impl_from_IDWriteFont
2
(
iface
);
struct
dwrite_font
*
This
=
impl_from_IDWriteFont
3
(
iface
);
HRESULT
hr
;
TRACE
(
"(%p)->(%p)
\n
"
,
This
,
face
);
...
...
@@ -1420,23 +1420,23 @@ static HRESULT WINAPI dwritefont_CreateFontFace(IDWriteFont2 *iface, IDWriteFont
return
hr
;
}
static
void
WINAPI
dwritefont1_GetMetrics
(
IDWriteFont
2
*
iface
,
DWRITE_FONT_METRICS1
*
metrics
)
static
void
WINAPI
dwritefont1_GetMetrics
(
IDWriteFont
3
*
iface
,
DWRITE_FONT_METRICS1
*
metrics
)
{
struct
dwrite_font
*
This
=
impl_from_IDWriteFont
2
(
iface
);
struct
dwrite_font
*
This
=
impl_from_IDWriteFont
3
(
iface
);
TRACE
(
"(%p)->(%p)
\n
"
,
This
,
metrics
);
*
metrics
=
This
->
data
->
metrics
;
}
static
void
WINAPI
dwritefont1_GetPanose
(
IDWriteFont
2
*
iface
,
DWRITE_PANOSE
*
panose
)
static
void
WINAPI
dwritefont1_GetPanose
(
IDWriteFont
3
*
iface
,
DWRITE_PANOSE
*
panose
)
{
struct
dwrite_font
*
This
=
impl_from_IDWriteFont
2
(
iface
);
struct
dwrite_font
*
This
=
impl_from_IDWriteFont
3
(
iface
);
TRACE
(
"(%p)->(%p)
\n
"
,
This
,
panose
);
*
panose
=
This
->
data
->
panose
;
}
static
HRESULT
WINAPI
dwritefont1_GetUnicodeRanges
(
IDWriteFont
2
*
iface
,
UINT32
max_count
,
DWRITE_UNICODE_RANGE
*
ranges
,
UINT32
*
count
)
static
HRESULT
WINAPI
dwritefont1_GetUnicodeRanges
(
IDWriteFont
3
*
iface
,
UINT32
max_count
,
DWRITE_UNICODE_RANGE
*
ranges
,
UINT32
*
count
)
{
struct
dwrite_font
*
This
=
impl_from_IDWriteFont
2
(
iface
);
struct
dwrite_font
*
This
=
impl_from_IDWriteFont
3
(
iface
);
IDWriteFontFace3
*
fontface
;
HRESULT
hr
;
...
...
@@ -1449,9 +1449,9 @@ static HRESULT WINAPI dwritefont1_GetUnicodeRanges(IDWriteFont2 *iface, UINT32 m
return
IDWriteFontFace3_GetUnicodeRanges
(
fontface
,
max_count
,
ranges
,
count
);
}
static
BOOL
WINAPI
dwritefont1_IsMonospacedFont
(
IDWriteFont
2
*
iface
)
static
BOOL
WINAPI
dwritefont1_IsMonospacedFont
(
IDWriteFont
3
*
iface
)
{
struct
dwrite_font
*
This
=
impl_from_IDWriteFont
2
(
iface
);
struct
dwrite_font
*
This
=
impl_from_IDWriteFont
3
(
iface
);
IDWriteFontFace3
*
fontface
;
HRESULT
hr
;
...
...
@@ -1464,9 +1464,9 @@ static BOOL WINAPI dwritefont1_IsMonospacedFont(IDWriteFont2 *iface)
return
IDWriteFontFace3_IsMonospacedFont
(
fontface
);
}
static
BOOL
WINAPI
dwritefont2_IsColorFont
(
IDWriteFont
2
*
iface
)
static
BOOL
WINAPI
dwritefont2_IsColorFont
(
IDWriteFont
3
*
iface
)
{
struct
dwrite_font
*
This
=
impl_from_IDWriteFont
2
(
iface
);
struct
dwrite_font
*
This
=
impl_from_IDWriteFont
3
(
iface
);
IDWriteFontFace3
*
fontface
;
HRESULT
hr
;
...
...
@@ -1479,7 +1479,42 @@ static BOOL WINAPI dwritefont2_IsColorFont(IDWriteFont2 *iface)
return
IDWriteFontFace3_IsColorFont
(
fontface
);
}
static
const
IDWriteFont2Vtbl
dwritefontvtbl
=
{
static
HRESULT
WINAPI
dwritefont3_CreateFontFace
(
IDWriteFont3
*
iface
,
IDWriteFontFace3
**
fontface
)
{
struct
dwrite_font
*
This
=
impl_from_IDWriteFont3
(
iface
);
FIXME
(
"(%p)->(%p): stub
\n
"
,
This
,
fontface
);
return
E_NOTIMPL
;
}
static
BOOL
WINAPI
dwritefont3_Equals
(
IDWriteFont3
*
iface
,
IDWriteFont
*
font
)
{
struct
dwrite_font
*
This
=
impl_from_IDWriteFont3
(
iface
);
FIXME
(
"(%p)->(%p): stub
\n
"
,
This
,
font
);
return
FALSE
;
}
static
HRESULT
WINAPI
dwritefont3_GetFontFaceReference
(
IDWriteFont3
*
iface
,
IDWriteFontFaceReference
**
reference
)
{
struct
dwrite_font
*
This
=
impl_from_IDWriteFont3
(
iface
);
FIXME
(
"(%p)->(%p): stub
\n
"
,
This
,
reference
);
return
E_NOTIMPL
;
}
static
BOOL
WINAPI
dwritefont3_HasCharacter
(
IDWriteFont3
*
iface
,
UINT32
ch
)
{
struct
dwrite_font
*
This
=
impl_from_IDWriteFont3
(
iface
);
FIXME
(
"(%p)->(0x%x): stub
\n
"
,
This
,
ch
);
return
FALSE
;
}
static
DWRITE_LOCALITY
WINAPI
dwritefont3_GetLocality
(
IDWriteFont3
*
iface
)
{
struct
dwrite_font
*
This
=
impl_from_IDWriteFont3
(
iface
);
FIXME
(
"(%p): stub
\n
"
,
This
);
return
DWRITE_LOCALITY_LOCAL
;
}
static
const
IDWriteFont3Vtbl
dwritefontvtbl
=
{
dwritefont_QueryInterface
,
dwritefont_AddRef
,
dwritefont_Release
,
...
...
@@ -1498,7 +1533,12 @@ static const IDWriteFont2Vtbl dwritefontvtbl = {
dwritefont1_GetPanose
,
dwritefont1_GetUnicodeRanges
,
dwritefont1_IsMonospacedFont
,
dwritefont2_IsColorFont
dwritefont2_IsColorFont
,
dwritefont3_CreateFontFace
,
dwritefont3_Equals
,
dwritefont3_GetFontFaceReference
,
dwritefont3_HasCharacter
,
dwritefont3_GetLocality
};
static
HRESULT
create_font
(
struct
dwrite_font_data
*
data
,
IDWriteFontFamily
*
family
,
IDWriteFont
**
font
)
...
...
@@ -1509,7 +1549,7 @@ static HRESULT create_font(struct dwrite_font_data *data, IDWriteFontFamily *fam
This
=
heap_alloc
(
sizeof
(
struct
dwrite_font
));
if
(
!
This
)
return
E_OUTOFMEMORY
;
This
->
IDWriteFont
2
_iface
.
lpVtbl
=
&
dwritefontvtbl
;
This
->
IDWriteFont
3
_iface
.
lpVtbl
=
&
dwritefontvtbl
;
This
->
ref
=
1
;
This
->
family
=
family
;
IDWriteFontFamily_AddRef
(
family
);
...
...
@@ -1517,7 +1557,7 @@ static HRESULT create_font(struct dwrite_font_data *data, IDWriteFontFamily *fam
This
->
data
=
data
;
InterlockedIncrement
(
&
This
->
data
->
ref
);
*
font
=
(
IDWriteFont
*
)
&
This
->
IDWriteFont
2
_iface
;
*
font
=
(
IDWriteFont
*
)
&
This
->
IDWriteFont
3
_iface
;
return
S_OK
;
}
...
...
dlls/dwrite/tests/font.c
View file @
fa6c255f
...
...
@@ -26,7 +26,7 @@
#include "windows.h"
#include "winternl.h"
#include "dwrite_
2
.h"
#include "dwrite_
3
.h"
#include "initguid.h"
#include "d2d1.h"
...
...
@@ -2415,8 +2415,6 @@ static void test_GetFontFromFontFace(void)
DELETE_FONTFILE
(
path
);
}
static
void
test_GetFirstMatchingFont
(
void
)
{
DWRITE_FONT_SIMULATIONS
simulations
;
...
...
@@ -5268,6 +5266,39 @@ static void test_TranslateColorGlyphRun(void)
IDWriteFactory2_Release
(
factory2
);
}
static
void
test_HasCharacter
(
void
)
{
IDWriteFactory3
*
factory3
;
IDWriteFactory
*
factory
;
IDWriteFont3
*
font3
;
IDWriteFont
*
font
;
HRESULT
hr
;
BOOL
ret
;
factory
=
create_factory
();
font
=
get_tahoma_instance
(
factory
,
DWRITE_FONT_STYLE_NORMAL
);
ok
(
font
!=
NULL
,
"failed to create font
\n
"
);
/* Win8 is broken, QI claims to support IDWriteFont3, but in fact it does not */
hr
=
IDWriteFactory_QueryInterface
(
factory
,
&
IID_IDWriteFactory3
,
(
void
**
)
&
factory3
);
if
(
hr
==
S_OK
)
{
hr
=
IDWriteFont_QueryInterface
(
font
,
&
IID_IDWriteFont3
,
(
void
**
)
&
font3
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
ret
=
IDWriteFont3_HasCharacter
(
font3
,
'A'
);
ok
(
ret
,
"got %d
\n
"
,
ret
);
IDWriteFont3_Release
(
font3
);
IDWriteFactory3_Release
(
factory3
);
}
else
skip
(
"IDWriteFont3 is not supported.
\n
"
);
IDWriteFont_Release
(
font
);
IDWriteFactory_Release
(
factory
);
}
START_TEST
(
font
)
{
IDWriteFactory
*
factory
;
...
...
@@ -5320,6 +5351,7 @@ START_TEST(font)
test_IsSymbolFont
();
test_GetPaletteEntries
();
test_TranslateColorGlyphRun
();
test_HasCharacter
();
IDWriteFactory_Release
(
factory
);
}
include/dwrite_3.idl
View file @
fa6c255f
...
...
@@ -252,3 +252,12 @@ interface IDWriteTextLayout3 : IDWriteTextLayout2
HRESULT
GetLineSpacing
(
DWRITE_LINE_SPACING
*
spacing
)
;
HRESULT
GetLineMetrics
(
DWRITE_LINE_METRICS1
*
metrics
,
UINT32
max_count
,
UINT32
*
count
)
;
}
[
local
,
object
,
uuid
(
9
a1b41c3
-
d3bb
-
466
a
-
87
fc
-
fe67556a3b65
)
]
interface
IDWriteFactory3
:
IDWriteFactory2
{
}
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